Forum Discussion
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
- Anonymous4 years ago
I figured out the solution myself. I had to add "Content.Create" API permission to the application registered in AAD.
3 Replies
- AnonymousNot applicable
I figured out the solution myself. I had to add "Content.Create" API permission to the application registered in AAD.
- v-chenwuz-msftCommunity Support
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
- AnonymousNot applicable
thanks, but it not work for me, dont know why