Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
michael_mcclari
Regular Visitor

Unable to do basic authentication with function

Hello, i am having trouble doing basic authentication within a function. Please see my code below:

 

GetData

(page as number) as table =>
let
    Source = Web.Page(Web.Contents("https://my_company.atlassian.net/rest/api/2/search?jql=created%20%3E%20startOfMonth()&maxResults=100&startAt=" & Number.ToText(page) & "00")),
    Data1 = Source{1}[Data],
    RemoveBottom = Table.RemoveLastN(Data1,3)
in
    Data1

The funny thing is that I have no trouble doing basic authentication with the exact same URL in another query that uses this function, except when it calls the function.

 

Page

let
    url = "https://my_company.atlassian.net/rest/api/2/search?jql=created%20%3E%20startOfMonth()&maxResults=100",
    query = Json.Document(Web.Contents(url)),
    total = query[total],
    maxResults = query[maxResults],
    N = total / maxResults,
    M = Number.RoundDown(N),
    Source = {1..M},
    ToTable = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    Renamed = Table.RenameColumns(ToTable,{{"Column1", "Page"}}),

    //Everything works fine including authentication to "url" on line 2 but fails when it calls "GetData" on the next line
    Added = Table.AddColumn(Renamed, "Custom", each GetData([Page]))
in
    Added

Seems Basic Authentication works differently when in a function.

 

Any assistance would be greatly apprecaiated.

 

Regards,

Mike

1 REPLY 1
lightw0rks
Frequent Visitor

Having the same problem. Does anyone know why Basic Authentication fails when WebContents is called within a function?

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.