Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
I am trying to run sample report https://docs.microsoft.com/en-us/power-bi/developer/embedded/embed-sample-for-customers?tabs=net-cor... and getting error "Operation returned an invalid status code 'Unauthorized''" at var pbiReport = pbiClient.Reports.GetReportInGroup(workspaceId, reportId);
I gave the user account admin right to the workspace, report and dataset.
Can someone please help?
Thanks,
William.
Hi @WilliamTit ,
Whether your problem has been resolved? If yes, could you please mark the helpful post as Answered? It will help the others in the community find the solution easily if they face the same problem as yours. Thank you.
Best Regards
Hi @WilliamTit ,
If you are using service principal authentication, please check whether you have enabled "Allow service principals to use Power BI APIs" feature in Admin portal.
Also, has the service principal been added as member or admin of workspace?
And you can refer the following video to check if something is missing...
Embed Power BI Report for Customers using App Own Concept and Service Principal
Embed Power BI Report for Customers using App Owns Data and Master User
In addition, the followings are the ones which has similar problem with yours. Hope they can help you.
Operation returned an invalid status code 'Unauthorized''
Based on your description, I assumed that you are using the Access token for Power BI users (user owns data) approach. I would recommend you use https://jwt.io/ to decode the access_token after successfully invoked
authContext.AcquireTokenAsync
. Make sure theaud
ishttps://analysis.windows.net/powerbi/api
and check the permissions scope propertyscp
.For Get Groups, the required scope would look as follows:
Required scope: Group.Read.All or Group.ReadWrite.All or Workspace.Read.All or Workspace.ReadWrite.All
You could also use fiddler or postman to simulate the request against the get groups endpoint with the access_token received in your WPF application to narrow down this issue.
Moreover, you could follow Register an application to check your Azure AD app and make sure the required delegated permissions to Power BI Service (Microsoft.Azure.AnalysisServices) API have been correctly configured.
401 when accessing any Power BI API endpoints
I found something that work and documented it (with code) here: https://bitbucket.org/omnistream/powerbi-api-exampleHopefully it would help other people in need!
It's not entirely satisfying: I'm notably not too sure why I should use this authentication endpoint instead of the one I found in other documentation, nor why I have to use a username/password on top of the app credentials, especially since it's not a super secure way to do it; I'm concerned it may get deprecated in the future. But it works.
Best Regards
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
17 | |
2 | |
2 | |
1 | |
1 |
User | Count |
---|---|
21 | |
2 | |
2 | |
2 | |
2 |