frictionlesspulley
frictionlesspulley

Reputation: 12408

PowerBiEmbedded token using Service Principal

I have a C# App that uses a Active Directory User to perform the following operations, I am trying to convert it to use a Active Directory Service Principal. I am using Power Embedded Workspace with Premium Capacity in Azure

However I am running into issues when trying to get the same actions performed using a Service Principal.

What have I tried

I have the following things setup

01. Tenant Settings -> Developer Options :

02. Workspace Settings : powerbi workspace -> access control

03. App Owns Data workflow

I am getting the error

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:\Campuslabs\TeamFoundation\PowerBI-Developer-Samples\.NET Core\Embed for your customers\AppOwnsData\Services\PbiEmbedService.cs:line 46
at AppOwnsData.Controllers.EmbedInfoController.GetEmbedInfo() in C:\Campuslabs\TeamFoundation\PowerBI-Developer-Samples\.NET Core\Embed for your customers\AppOwnsData\Controllers\EmbedInfoController.cs:line 45

My question is

  1. How do I troubleshoot this issue

  2. Are Service Principal Credentials allowed to refresh / create / data sets on Power Embedded Workspace with Premium Capacity

Upvotes: 1

Views: 1043

Answers (1)

Sabre Ammar
Sabre Ammar

Reputation: 11

  1. Regarding trouble shooting, it seems from the error stack you sent that the issue lies with permissions on the workspace, double check that the Service Principal you added as an admin on the workspace is the same one you are using in your app.
  2. Regarding the second question, the answer to that is yes. A Service Principal can refresh / create / data sets on Power Embedded Workspace with Premium Capacity.

Upvotes: 1

Related Questions