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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Arnoh
Helper III
Helper III

Power BI Service not sending Basic Authentication with Web.Contents using RelativePath

Hi everyone,

I have a dataset in Power BI Desktop that uses the following M code to retrieve paginated data from the API. It works perfectly in Desktop — all pages are fetched using Web.Contents with RelativePath and Query parameters.

 

let

    BaseUrl = "https://app.xxxxx.com   ",

    Endpoint = "api/v2/employees",

 

    GetPage = (PageNumber as number) =>

    let

        Source = Json.Document(Web.Contents(BaseUrl, [

            RelativePath = Endpoint,

            Query = [

                page = Number.ToText(PageNumber),

                size = "100"

            ]

        ])),

        Bron = Source[items],

        Data = Table.FromRecords(Bron)

    in

        Data,

 

    FirstPage = Json.Document(Web.Contents(BaseUrl, [

        RelativePath = Endpoint,

        Query = [

            page = "0",

            size = "100"

        ]

    ])),

    TotalPages = FirstPage[totalPages],

    PageNumbers = List.Numbers(0, TotalPages),

    CombinedData = Table.Combine(List.Transform(PageNumbers, each GetPage(_)))

in

    CombinedData 

 

 

This setup works flawlessly in Power BI Desktop. However, once I publish the dataset to the Power BI Service and try to refresh it, I get the following error:

 

The credentials provided for the Web source are invalid. (Source at  https://app.xxxxx.com/api/v2/employees  .) 

In the Power BI Service, the credentials are correctly configured as Basic Authentication for  https://app.xxxxx.com/  , and the data source appears correctly under dataset settings. Yet it seems that the credentials are not being sent with the actual API calls in the Service.

 

What I’ve tried: 

    • Confimed that credentials are correctly set for in the power bi service for 

 

My suspicion: 

Power BI Service does not send Basic Authentication headers when using Web.Contents with RelativePath and Query, even when credentials are set at the root domain level.

 

My questions:

  • Is this a known limitation in Power BI Service?
  • Are there any best practices to make Basic Authentication work with RelativePath?

 

Any help or confirmation of this behavior would be greatly appreciated.

Thanks in advance!

2 ACCEPTED SOLUTIONS
rohit1991
Super User
Super User

Hi @Arnoh ,
Great to hear you identified the root cause! When visuals show “Visual has pending changes” and require manual refreshing after a dataset update, it’s often due to the "Pause visuals" setting under the Optimization pane being enabled. This feature is helpful when working with large models or making several changes, as it temporarily suspends visual updates for performance, but can be confusing if toggled unintentionally. If anyone else encounters this issue, simply go to the “Optimize” ribbon in Power BI Desktop and uncheck “Pause visuals.” Once deselected, your visuals will resume auto-refreshing as expected after dataset updates. Also, keeping Power BI Desktop updated and clearing the cache occasionally can help avoid unexpected behavior.

 


Did it work? ✔ Give a Kudo • Mark as Solution – help others too!

View solution in original post

Arnoh
Helper III
Helper III

Hi it seems to be an issue in the power bi service. But there is a workaround you can make a connection inside the power bi service instead of entering the credintials in the workspace. 

View solution in original post

7 REPLIES 7
Arnoh
Helper III
Helper III

Hi it seems to be an issue in the power bi service. But there is a workaround you can make a connection inside the power bi service instead of entering the credintials in the workspace. 

Anonymous
Not applicable

Hi @Arnoh 
I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.
Thank you.

Anonymous
Not applicable

Hi @Arnoh 
I wanted to check if you had the opportunity to review the information provided  by @Akash_Varuna  and @rohit1991 . Please feel free to contact us if you have any further questions. If their response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you.

rohit1991
Super User
Super User

Hi @Arnoh ,
Great to hear you identified the root cause! When visuals show “Visual has pending changes” and require manual refreshing after a dataset update, it’s often due to the "Pause visuals" setting under the Optimization pane being enabled. This feature is helpful when working with large models or making several changes, as it temporarily suspends visual updates for performance, but can be confusing if toggled unintentionally. If anyone else encounters this issue, simply go to the “Optimize” ribbon in Power BI Desktop and uncheck “Pause visuals.” Once deselected, your visuals will resume auto-refreshing as expected after dataset updates. Also, keeping Power BI Desktop updated and clearing the cache occasionally can help avoid unexpected behavior.

 


Did it work? ✔ Give a Kudo • Mark as Solution – help others too!

Hi All

 

I've encountered the very same problem

  • And the solution for me, which @florianh suggested in this thread: Failed to update data source credentials
  • Was to tick "Skip Test Connection" when editing the Data Source Credentials
  • I'm guessing that because of the way the URL is constructed in the M code, to bring back and combine all the paginated pages
  • That the Power BI Service only supplies the base URL when testing the connection
  • Which will obviously fail, as it doesn't contain the API Key
  • So, I presume skipping the test connection lest you set up the credentials
  • Which then work correctly when refreshing the data set, as the full url, with the API Key, is passed to the API

Can any of the experts on here clarify that this is the accepted solution to this problem?

 

Also, why is there a response in this thread about Paused Visuals, where did that come from, as it seems to have nothing to do with the original question?

 

I've also added my M code below, if that helps anyone else reading this thread - Credit to @v-ssriganesh@BA_Pete and @v-dineshya for helping to adapt my original code in to a working solution

 

Cheers

Jim

 

let
    // Base URL and parameters
    BaseUrl = "https://api.XXXXX.com",
    ApiToken = "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
    Limit = 500,
    InitialStart = 0,

    // Function to fetch one page of results
    GetPage = (Start as number) =>
        if Start = null then
            [Data = {}, More = false, NextStart = null]
        else
            let
//                Url = BaseUrl & "start=" & Text.From(Start) & "&limit=" & Text.From(Limit) & "&api_token=" & ApiToken,
//                Response = Json.Document(Web.Contents(Url)),
                Response = Json.Document(
                    Web.Contents(
                        BaseUrl, [
                            RelativePath =  "/v1/organizations?",
                            Query = [
                                    start = Text.From(Start),
                                    limit = Text.From(Limit),
                                    api_token = ApiToken
                            ]
                        ]
                    )
                ),
                Data = Response[data],
                More = try Response[additional_data][pagination][more_items_in_collection] = true otherwise false,
                NextStart = try Response[additional_data][pagination][next_start] otherwise null
            in
                [Data = Data, More = More, NextStart = NextStart],

    // Loop through all pages using List.Generate
    AllPages = List.Generate(
        () => [Result = GetPage(InitialStart), Continue = true],
        each [Continue],
        each [
            Result = GetPage([Result][NextStart]),
            Continue = [Result][More]
        ],
        each [Result][Data]
    ),

    // Flatten all results into one list
    Combined = List.Combine(AllPages),
 
    // Convert to table, automatically detecting columns
    RawTable = Table.FromRecords(Combined)

in
    RawTable

 

Anonymous
Not applicable

Hi @Arnoh 

May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

Thank you.

Akash_Varuna
Super User
Super User

Hi @Arnoh It might be because Power BI Service doesn’t send Basic Authentication headers with RelativePath. Combine the full URL in Web.Contents, or include the Authorization header with Base64-encoded credentials. Another thing you could try is setting credentials for the exact API endpoint instead of the root domain. I think this is a known limitation, so avoid RelativePath and use full URLs or custom headers for consistency.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors