Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
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": "comp1@tek.com",
"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....?
Solved! Go to Solution.
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
Hi you got any solution. I am stuck in same issue!
same issue too, do you have any solution
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.
thanks. But i have done this
OneDriveAppOwnsData.sln
this is running project for your reference. May be it can help you!!
thanks, this is only the sln file, maybe you miss some others. And I want to know if you use the service principle to add or update data to powerBI, I can access to getworkspace, but fialed when try to upload new report, meet the 'unauthorized', I think maybe it is read-only?
Sorry for inconvinience, PFB updated link
Check if this runs for you or not after replacing all the values in json
Embed for your customers.rar
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
Yes. It's great.
Anyone can update relate this issue pls..
This is very very urgent.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
19 | |
16 | |
14 | |
12 | |
11 |
User | Count |
---|---|
32 | |
25 | |
25 | |
19 | |
19 |