Forum Discussion
Operation returned an invalid status code 'Unauthorized' while connecting Power BI embed app.
I am getting error in the below line while connecting Power BI with embed app.
I have give all id's in JSON settings like below.
"AzureAd": {
"AuthenticationMode": "ServicePrincipal",
//"AuthorityUrl": "https://login.microsoftonline.com/organizations/",
"AuthorityUrl": "https://login.microsoftonline.com/que8ad7-adsd-w22sf-23iuhsasd",
"ClientId": "fdsguy-erhdj-rtyuiw-32987ud-fdwiu8ds7s",
"TenantId": "8fdf987ad87-dsafi-ytrt5-niuwoiuafm09er9",
"ScopeBase": [ "https://analysis.windows.net/powerbi/api/.default" ],
"PbiUsername": "[email protected]",
"PbiPassword": "************",
"ClientSecret": "fdsgshfgajdad-dafdbvnvfoiepi-3edfsfdshj"
},
"PowerBI": {
"WorkspaceId": "4398dsewwsdfkg-fdijo-hoigu-kjfdj-irkfjfjdsa0w987e",
"ReportId": "fvxcn-cvkbvj-vcxbivc-vcxbj-er9rekjxlj",
"DataSetId": "hfakjfdadaf-adsfljjreuu8-fdld87fsf-fsghfkfs"
But, still i am getting below error.
Error Details:
Operation returned an invalid status code 'Unauthorized'
at Microsoft.PowerBI.Api.ReportsOperations.GetReportInGroupWithHttpMessagesAsync(Guid groupId, Guid reportId, Dictionary`2 customHeaders, CancellationToken cancellationToken)
at Microsoft.PowerBI.Api.ReportsOperationsExtensions.GetReportInGroupAsync(IReportsOperations operations, Guid groupId, Guid reportId, CancellationToken cancellationToken)
at Microsoft.PowerBI.Api.ReportsOperationsExtensions.GetReportInGroup(IReportsOperations operations, Guid groupId, Guid reportId)
at AppOwnsData.Services.PbiEmbedService.GetEmbedParams(Guid workspaceId, Guid reportId, Guid additionalDatasetId) in C:\Users\PowerBI-Developer-Samples-master\.NET Core\Embed for your customers\AppOwnsData\Services\PbiEmbedService.cs:line 46
at AppOwnsData.Controllers.EmbedInfoController.GetEmbedInfo() in C:\Users\PowerBI-Developer-Samples-master\.NET Core\Embed for your customers\AppOwnsData\Controllers\EmbedInfoController.cs:line 45
below is my code
public PowerBIClient GetPowerBIClient()
{
var tokenCredentials = new TokenCredentials(aadService.GetAccessToken(), "Bearer");
return new PowerBIClient(new Uri(powerBiApiUrl ), tokenCredentials);
}
Error line
*******************
PowerBIClient pbiClient = this.GetPowerBIClient();
// Get report info
var pbiReport = pbiClient.Reports.GetReportInGroup(workspaceId, reportId); ==> Error Line
What is the error and how we could solve this....?
- Anonymous3 years ago
Hi saivina2920 ,
Could it be permission issue?
The account must be the admin of the related workspaces when you need to embeded report in the application.
Best Regards,
Jay
10 Replies
- saivina2920Post Prodigy
Anyone can update relate this issue pls..
This is very very urgent.
- AnonymousNot applicable
Hi saivina2920 ,
Could it be permission issue?
The account must be the admin of the related workspaces when you need to embeded report in the application.
Best Regards,
Jay
- saivina2920Post Prodigy
Yes. It's great.
- MRIZHelper II
Hi you got any solution. I am stuck in same issue!
- AnonymousNot applicable
same issue too, do you have any solution
- MRIZHelper II
Hi, yes this issue was resolved for me. I did different things i am forgetting it, I guess I was forgetting to give admin access to my Service Pricncipal on my WorkSpace is Worspace Access option.