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

Join 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.

Reply
mamta-bmore
Frequent Visitor

PowerBINotAuthorizedException :: Embed report via access token

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.. 

 

 

 

 

4 REPLIES 4
mamta-bmore
Frequent Visitor

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 

mamtabmore_0-1628596815739.png

 

Also I have change Authentication mode from 'ServicePrincipal' to 'masteruser' 

 

mamta-bmore
Frequent Visitor

Thanks ibarrau for quick reply.. By default I have granted all API permissons

 

mamtabmore_0-1628522864887.png

 

and Grant Admin consent is also selected.

Ok, then there might be two possible reasons:

 

  • Wrong group ID
  • Unauthorized group

Be sure that the url is ok and that the Service Principal or User has admin permission on the workspace.

 


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Happy to help!

LaDataWeb Blog

ibarrau
Super User
Super User

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,

 


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Happy to help!

LaDataWeb Blog

Helpful resources

Announcements
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.