Forum Discussion
How to Power Query with Excel and Organizational account?
- 7 months ago
This is a limitation of Power Query.
Excel’s “Organizational account” authentication does not work properly with custom OAuth-protected APIs, especially when the API is running on localhost. Power Query ignores the client_id and scope returned in the WWW-Authenticate header and always requests a token for its own default audience. Your API then rejects the token, which is why this fails even though login succeeds.
There are really only two reliable fixes:
Fix 1: Use client credentials
Switch the API to client credentials flow and request the token directly in Power Query, then pass it in the Authorization header. This works in both Excel and Power BI, but it won’t give you per-user identity.Fix 2: Use a Power Query custom connector
If you need user-based authentication, you’ll need to build a custom Power Query connector (.mez) and implement OAuth explicitly. This is the only supported way to control client_id, scope, and audience for a custom API.Organizational account auth in Power Query is meant for Microsoft resources, not arbitrary protected APIs.
Authentication in desktop apps (covers how Power Query handles Azure AD / organizational account)
https://learn.microsoft.com/en-us/power-query/connector-authenticationPower Query custom connector authentication (OAuth flow basics)
https://learn.microsoft.com/en-us/power-query/handling-authenticationGuidance on configuring Microsoft Entra (Azure AD) for custom connectors
https://learn.microsoft.com/en-us/power-query/configure-microsoft-entra-for-connector
Hello albertino_87,
We hope you're doing well. Could you please confirm whether your issue has been resolved or if you're still facing challenges? Your update will be valuable to the community and may assist others with similar concerns.
Thank you.
- albertino_876 months agoNew Member
Hi v-ssriganesh, well I haven't resolved the issue, I don't know how to create a custom connector but at least I know that it's not supposed to work as is.
Many thanks
Alberto
- v-ssriganesh6 months agoCommunity Support
Hello albertino_87,
Please consider raising a Microsoft support ticket for further investigation. You can explain all the troubleshooting steps you have taken to help them better understand the issue.
You can create a Microsoft support ticket with the help of the link below:
https://learn.microsoft.com/en-us/power-bi/support/create-support-ticket- v-ssriganesh6 months agoCommunity Support
Hi albertino_87, hope you are doing well. Just wanted to know if your issue has been resolved through your support ticket with Microsoft? If so, we would greatly appreciate it if you could share the insights here, as they may benefit others with similar issues. If you have any other queries, please feel free to raise a new post in the community. We are always happy to help. Thank you.