Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.
I have requirement to access BI reports.. by programmatically deriving the access token so that users doesn't have to signup in order to view the reports.
I followed the link
https://docs.microsoft.com/en-us/power-bi/developer/embedded/embed-sample-for-customers?tabs=python.
to embed the report in my application.
I downloaded the sample app for python and executed it.. I get the access token but accessing report gives error
Error Details:
401 Unauthorized: Error while retrieving Embed URL
Unauthorized: {"error":{"code":"PowerBINotAuthorizedException","pbi.error":{"code":"PowerBINotAuthorizedException","parameters":{},"details":[],"exceptionCulprit":1}}}
RequestId: c16c2dff-d7ef-4b4e-b0ce-1f9c67f9ae9a
In accepted solution of https://powerusers.microsoft.com/t5/Building-Flows/Power-BI-Connector-PowerBINotAuthorizedException/... says to use Premium capacity for the report/workspace
Before moving to production , I wanted to test the solution .. is there any way to make this works without creating capacity.
Or am I missing any other configuration apart from what is mentioned in the above links..
I think I am able to resolve the problem..
In addition to API permissions. we have to allow public client flows.
Its under [app registration name] > Authentication > Advanced Settings
Also I have change Authentication mode from 'ServicePrincipal' to 'masteruser'
Thanks ibarrau for quick reply.. By default I have granted all API permissons
and Grant Admin consent is also selected.
Ok, then there might be two possible reasons:
Be sure that the url is ok and that the Service Principal or User has admin permission on the workspace.
Happy to help!
Hi. That means that your App registered doesn't have the permission to do that action. Be sure that you have all the permissions for the App. When login with Service Principal that's all.
https://docs.microsoft.com/en-us/power-bi/developer/embedded/generate-embed-token#access-level
If you are login in with an Azure AD Account then don't forget that "Your master user or an administrator has to grant consent for your app to access Power BI REST API permissions (also known as scopes). For example, Report.ReadWrite.All."
I hope that helps,
Happy to help!