Forum Discussion
Timeout getting Auth Token from MS Graph or PBI API
- 1 year ago
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.
Hi jake_BIV ,
This one’s been a pain point for a lot of folks, so here’s a condensed troubleshooting list that’s helped me (and others) get past MS Graph/PBI API token timeouts in Power BI Service:
1. Use the latest v2.0 endpoint: Update your token request to https://login.microsoftonline.com/<tenant>/oauth2/v2.0/token (the v2 endpoint has fixed some recent issues for many people).
2. Test outside Power BI Service: Try the exact same call in Postman or curl. If it works there but not in Power BI Service, the problem is likely with the Power BI Service environment or some tenant setting not your script.
3. Double-check Azure permissions and secrets: Make sure your Azure AD app registration has the right permissions, and that your client secret hasn’t expired or been rotated. Also, review any Conditional Access Policies your org may have added.
4. If using an On-prem Gateway, update it: Outdated gateways can break cloud authentication flows.
5. In Power Query, disable load on helper queries: Right-click and disable load on your authentication/token steps, so they aren’t treated as tables.
6. Enable diagnostics/logging: Turn on Power BI logging (under options > diagnostics). Sometimes the logs will
give you a clue especially if there’s a subtle permissions or network issue.
7. Escalate with Microsoft Support if needed: If you’re stuck, open a ticket and mention if others are seeing the same thing numbers matter with MS support. It sometimes resolves on its own if it’s on their side.
If you’re doing scheduled refreshes, make sure you’re not trying to generate a new token for every row/query just once per refresh.
- jake_BIV1 year agoHelper I
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