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
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
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.