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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
aaronfdsouza
Frequent Visitor

Getting forbidden error when trying to create a workspace using the dotnet core SDK

I am using the dotnet core SDK with a service principal and I need to create a workspace. 

My code looks like this

 

 

var credentials = await Token.GetTokenCredentials(clientId, clientSecret, tenantId);
using (PowerBIClient client = new PowerBIClient(credentials))
{
  GroupCreationRequest request = new GroupCreationRequest
  {
    Name = "MyNewWorkspace"
  };
  await client.Groups.CreateGroupAsync(request);
}

 

 

 

The service principal corresponding to the client has the following API permissions

  • Capacity.Read.All
  • Capacity.ReadWrite.All
  • Workspace.Read.All
  • Workspace.ReadWrite.All

    Is there some admin level setting that I need to be aware of?

     

     

1 ACCEPTED SOLUTION
aaronfdsouza
Frequent Visitor

I found that my administrator has restricted access.

View solution in original post

2 REPLIES 2
aaronfdsouza
Frequent Visitor

I found that my administrator has restricted access.

Anonymous
Not applicable

Hi @aaronfdsouza ,

 

As far as I know, we can use API call by a service principal profile to create a new workspace in Power BI Service. For more information see: Service principal profiles in Power BI Embedded.

For more details about this REST API.

Groups - Create Group - REST API (Power BI Power BI REST APIs) | Microsoft Learn

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.