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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
jake_BIV
Helper I
Helper I

Timeout getting Auth Token from MS Graph or PBI API

I have an issue that I need some help on. I am working with Microsoft support, but they are striking out so far. I am hoping someone has some more info that I can provide them. Here is the situation:

BACKGROUND

  • I have multiple M-script Power Query that runs in Gen 1 and Gen 2 dataflows. It gets the Auth Token from Microsoft Graph and POwer BI APIs.
  • The code runs across multiple tenants and each has been running for 1+ years with no issue.
  • On 1/9/2024, all of the scheduled queries (across all tenants) failed on refresh and have been broken since.
  • The script below currently works fine in Power BI Desktop, and Postman will return a token using the same Client/Secret so I know that works.
  • When I go into the Power Query Editor in PBI service and try to refresh the query to generate the token, it just times out after 10 mins. 

 

ERROR MESSAGE:
Error Code: Mashup Exception Data Source Error, Error Details: Couldn't refresh the entity because of an issue with the mashup document MashupException.Error: DataSource.Error: The operation has timed out Details: Reason = DataSource.Error;Detail = https://login.microsoftonline.com/***************/oauth2/token;Microsoft.Data.Mashup.Error.Context = User (Request ID: 939c7c09-215d-4f87-afb2-f15f1655502f).

 

M-Script:

let
  TokenUri = "https://login.microsoftonline.com/" & TenantID & "/oauth2/token",
  ResourceId = "https://graph.microsoft.com",
  TokenResponse = Json.Document(Web.Contents(TokenUri,
  [
  Content = Text.ToBinary(Uri.BuildQueryString([client_id = AppID, resource = ResourceId, grant_type = "client_credentials", client_secret = Secret])),
  Headers = [Accept = "application/json"], ManualStatusHandling = {400}
        ]
    )),
  AzureAccessToken = TokenResponse[access_token]
in
  AzureAccessToken

 

1 ACCEPTED SOLUTION

Yes. The issue seems to have gone away about 3 days ago across all tenants at the same time.  First level support doest seem to know much.  I'm happy it's fixed but a little disappointed in the lack of understanding and communication. 

View solution in original post

18 REPLIES 18
v-shamiliv
Community Support
Community Support

Hi @jake_BIV 
Great to hear that your issue has been resolved. 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.

v-shamiliv
Community Support
Community Support

Hi @jake_BIV 
Thank you for reaching out microsoft fabric community forum.
we understand your frustration and concerns. Could you please provide an update on the status of your ticket? Has the issue been resolved or has the support team provided any solution ?
Thank you.

Yes. The issue seems to have gone away about 3 days ago across all tenants at the same time.  First level support doest seem to know much.  I'm happy it's fixed but a little disappointed in the lack of understanding and communication. 

Has been away, but my teammates noticed that the issue has been fixed..

rohit1991
Super User
Super User

Hi @jake_BIV ,

Here's a concise troubleshooting guide for your issue:

  1. Update Authentication Endpoint: Switch to the newer /oauth2/v2.0/token endpoint in your TokenUri: TokenUri = "https://login.microsoftonline.com/" & TenantID & "/oauth2/v2.0/token",

  2. Network Latency: Test the latency of the endpoint using tools like Postman. If it’s slow, contact Microsoft Support.

  3. Power BI Service Timeout: Ensure your request completes within 10 minutes. Optimize by reducing payload size or leveraging asynchronous dataflows.

  4. Service Dependency Changes: Verify tenant-specific API configurations and permissions. Ensure they match Microsoft's latest requirements.

  5. Logging and Debugging: Enable detailed logging in Power BI for additional diagnostics.

@rohit1991  Thank you for your response. I changed the Token request to v2 (was: v1), however I get the same result in Power BI Service.  Do you have any other suggestions?

I am following the instructions here.
https://learn.microsoft.com/en-us/graph/auth-v2-service?tabs=curl

Note: All works fine in Power BI Desktop to generate a token in 1-2 seconds.However, in Power BI Service it times out with no response.

M-Code Sample: 
let
TokenUri = "https://login.microsoftonline.com/" & TenantID & "/oauth2/v2.0/token",
ResourceId = "https://graph.microsoft.com/.default",
TokenResponse = Json.Document(Web.Contents(TokenUri,
[
Content = Text.ToBinary(Uri.BuildQueryString([client_id = AppID, scope = ResourceId, grant_type = "client_credentials", client_secret = Secret])),
Headers = [Accept = "application/json",#"Content-Type"= "application/x-www-form-urlencoded" ], ManualStatusHandling = {400}
]
)),
AzureAccessToken = TokenResponse[access_token]
in
AzureAccessToken

SaiTejaTalasila
Super User
Super User

Hi @jake_BIV ,

 

My recommendation will be getting tenant id, client id,client secret from your organisations AD team, with this details you can create one function to generate access token and you can pass it through your m-query.I'm doing the same to pull data from MS graph.

 

I hope it will be helpful.

 

Thanks,

Sai Teja 

@SaiTejaTalasila 

That is what this query was doing. It was generating the token (from the Tenant, Client, Secret parameters), then passing to the next query. 

The problem is that its not generating an access token.  Do you have an example of the m-code function you are using to generate the token? Is it working in Power BI Service? Is it different than the M-Script I provided?

Hi @jake_BIV ,

 

Try this -

-Disable load for all parameters (right click and disable load). Don't disable it for access token function query.

-authentication type- anonymous and privacy -public.

 

I hope it works. If it's not working you can reach out to me directly and I will be able share how I defined parameters and created the function to generate access token.

 

 

Thanks,

Sai Teja 

 

@SaiTejaTalasila I have created a test Gen1 dataflows in Power BI service and setup as a function. The only change was setting the Privacy to 'Public' (Was: Organiztional). However, I am getting the same issue. Please note it works fine in Power BI Desktop so that tells me the syntax and parameters are all correct. 

I am going to reach out to you via private chat to see if you can share what you are doing. I would expect you to be having the same issue in PBI Service.


Hello,

 

It's happening the same on my end, Power BI Desktop can make a request a get the access token, but via Power BI service the result is a timeout.

 

Have you fixed it?

 

Regards,

@AlejandroOS  Not yet. There is a ticket into Microsoft (Case 2501130040010453). They seem to be confused. I am trying to get it escalated. I will update when there is a solution. Please let me know if you find something.

Hey @jake_BIV , did you get anywhere with this? We have the same issue - longstanding gen 1 dataflow stopped working on the 14th Jan, seems to be the same issue where it times out fetching the bearer token.

@njbulls20  Not yet. I have a ticket in with Microsoft, but they seem to think it's something I did. I am surprised more persons are not having the same issue. I am glad you reached out. Can you please put in a ticket with Microsoft and provide me the case #. You can reference my case number below in your ticket.  Maybe if enough users put tickets in for the same issue we will get some traction. 

@jake_BIV my issue seems to have been resolved over the weekend - my dataflow has run with success for the past 4 days (no changes or intervention from me). 

 

Hopefully your issue is resolved too soon (this happened to me a few months ago, so i'm not 100% convinced the issue won't re-appear at some point, unless MS can confirm otherwise).

Same for me.  Seems like a patch or bug fix went through. Happy is fixed,  but disappointed in the poor support. 

Hi,
Maybe you can redirect them to my case 2501161410000011. So that they can put there resources more focused.

@AlejandroOS  Have you submitted a ticket to Microsoft on the issue?

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.