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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Operation returned an invalid status code 'Unauthorized'

When testing an embedded app in Power BI, I am able to get it working with "ServicePrincipal" authentication type, but when I use "MasterUser" authentication type, I get the following error message. What do I need to do to fix this?

----------------------

Error Details:
Operation returned an invalid status code 'Unauthorized'

at Microsoft.PowerBI.Api.EmbedTokenOperations.GenerateTokenWithHttpMessagesAsync(GenerateTokenRequestV2 requestParameters, Dictionary`2 customHeaders, CancellationToken cancellationToken)
at Microsoft.PowerBI.Api.EmbedTokenOperationsExtensions.GenerateTokenAsync(IEmbedTokenOperations operations, GenerateTokenRequestV2 requestParameters, CancellationToken cancellationToken)
at Microsoft.PowerBI.Api.EmbedTokenOperationsExtensions.GenerateToken(IEmbedTokenOperations operations, GenerateTokenRequestV2 requestParameters)
at AppOwnsData.Services.PbiEmbedService.GetEmbedToken(Guid reportId, IList`1 datasetIds, Guid targetWorkspaceId) in C:\PowerBI\PowerBI-Developer-Samples-master\.NET Core\Embed for your customers\AppOwnsData\Services\PbiEmbedService.cs:line 167
at AppOwnsData.Services.PbiEmbedService.GetEmbedParams(Guid workspaceId, Guid reportId, Guid additionalDatasetId) in C:\PowerBI\PowerBI-Developer-Samples-master\.NET Core\Embed for your customers\AppOwnsData\Services\PbiEmbedService.cs:line 75
at AppOwnsData.Controllers.EmbedInfoController.GetEmbedInfo() in C:\PowerBI\PowerBI-Developer-Samples-master\.NET Core\Embed for your customers\AppOwnsData\Controllers\EmbedInfoController.cs:line 45

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

I figured out the solution myself. I had to add "Content.Create" API permission to the application registered in AAD.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

I figured out the solution myself. I had to add "Content.Create" API permission to the application registered in AAD.

Anonymous
Not applicable

thanks, but it not work for me, dont know why

Hi @Anonymous ,

 

Thank you for sharing your problem and solution. Please mark your solution, if someone has the same problem, it will be solved quickly.

 

Best Regards

Community Support Team _ chenwu zhu

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.