Error Details: Operation returned an invalid status code 'Unauthorized' Microsoft.PowerBI.Api.ReportsOperations.GetReportInGroupWithHttpMessagesAsync(Guid groupId, Guid reportId, Dictionary\<string, List\<string\>\> customHeaders, CancellationToken cancellationToken) Microsoft.PowerBI.Api.ReportsOperationsExtensions.GetReportInGroupAsync(IReportsOperations operations, Guid groupId, Guid reportId, CancellationToken cancellationToken) testProjec.Services.PowerBiServiceApi.GetReport(Guid WorkspaceId, Guid ReportId) in PowerBiServiceApi.cs \+ var report = await pbiClient.Reports.GetReportInGroupAsync(WorkspaceId, ReportId); testProjec.Controllers.HomeController.Embed() in HomeController.cs \+ var viewModel = await powerBiServiceApi.GetReport(workspaceId, reportId);
I used dot net core and MVC this error comes up I tried to embed power bi for customer but the same error comes up i been trying to resolve this error for the last two days but i can't be solved
microsoft powerbi dotnet manual
microsoft powerbi html embed manual I
I tried seveal methods to resolve the problem like enabling the power bi apis in powerbi settings giving permision in azure portal
eventhougt it don't work I'm getting the same error
is there any thingh i need to enable is there any steps I'm missing
I even tried embedding with the microsoft given sample code microsoft example code
noting world I don't know what to do
Operation returned an invalid status code 'Unauthorized' - Power bi embeded
When I ran similar code without adding service principal under workspace, I too got same error Operation returned an invalid status code ‘Unauthorized’:
Response:
To resolve the error, make sure to add the service principal under your Power Bi workspace with proper access like below:
When I ran the code again after few minutes, I got the response successfully with report details:
Response:
Reference:
Embed content in your Power BI embedded analytics application | Microsoft