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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
wpq
New Member

Can't assign a capacity to workspace via API, 401 Unauthorized

I have a user, with whom I can assign a capacity on app.powerbi.com/group/id in settings -> premium.

I also have an azure app with all delegated permissions (embed for customer scenario).

I programatically clone the workspace, refresh dataset and the last step should be assigning a capacity for the workspace.

 https://api.powerbi.com/v1.0/myorg/capacities returns  

 

{
 id": "some id",
 displayName": "Premium Per User - Reserved",
 admins": [],
 sku": "PP3",
 state": "Active",
 capacityUserAccessRight": "Assign",
 region": "North Europe",
 users": []
}

 

But when I use the returned capacity id in body request for this endpoint:
https://api.powerbi.com/v1.0/myorg/groups/my-workspace-id/AssignToCapacity, I get 401 Unauthorized. 

What can be the issue here? Running out of ideas

3 REPLIES 3
cstrempfer
New Member

I had the same issue with a Microsoft Fabric capacity in Azure.

The account that calls the API must be configured as Capacity Adminstrator in the resource's settings. RBAC roles are not sufficient in this case.

menita_s
New Member

I have a similar problem. I am using ServicePrincipal in my API. I am able to successfully create a new workspace, add admin users, create/clone datasets/reports. But I cant seem to assign the workspace to a embedded capacity.  I get the below exception 

 

Microsoft.Rest.HttpOperationException: Operation returned an invalid status code 'Unauthorized'

 

Is this is known issue. Please respond if anyone has a solution to this problem. My entire POC rests in a successful creation of workspace through API without any manual interaction 

 

Menita

wpq
New Member

The problem persists, any ideas? 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.