Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

assign group to capacity via SDK returns unauthorized

I am implementing a provisioning tool using the PowerBI.CSharp.SDK, authenticating to PowerBI using a service principal.

The code is based on the AppOwnsData code sample for authentication.

 

I can successfully create a new workspace, import a PBIX, and modify the datasource and credentials to point to a specific Azure SQL database.

 

I need to assign the new workspace to a PowerBI Embedded capacity. I can do this in the powerbi portal, but my code returns "unauthorized" despite the service principal having:

  • admin rights to the workspace
  • added as capacity admin
  • assigned Tenant.Read.All & Tenant.ReadWrite.All API permissions
  • Given the Power BI Administrators role in Azure AD

The code looks like this, and I have verified that the workspace id and capacity id are valid.Screenshot 2021-02-12 155206.png

Fails on the last line with Unauthorised response from the REST API.

Can anyone spot what am I doing wrong?

 

 

1 REPLY 1
v-alq-msft
Community Support
Community Support

Hi, @Anonymous 

 

It seems there is something wrong with authorization from the rest api. I can't reproduce your scenario, I'd like to suggest you open a support ticket here if you have a pro license for further help.

 

Best Regards
Allan

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.