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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
JamesCSV
New Member

Add Service Principal Profile as anything but Admin

I have setup AppOwnsData embedding with service principal profiles and everything is working as expected when you create a workspace as a profile using the powerbi .net sdk.  When creating the workspace using the profile id header, it correctly creates the workspace and automatically assigns the profile id that was in the header, as the admin of the workspace.

Now I need to have other service principal profiles added to the same workspace, but I don't want them to be the admin of the workspace, but viewers or contributors since I will be applying RLS to further filter the data through DAX in a Parent Client/Child Client scenario.

My question is why can't I add a service principal profile as anything else than "Admin"? 

I get a 400 bad request each time I try to add them as something other than admin.  If I set the GroupUserAccessRight to "Admin", it works as expected and I can give access to multiple service principal profiles to the same workspace.  The same issue is shown if I go into the workspace in app.powerbi.com and try to change the service principal profile to Viewer/Member/Contributor.  I get an error in the UI shown below.

Is this just a limitation that I am not aware of or couldn't find documentation on?  What would be the reasoning of only allowing adding sp profiles as admins?  

JamesCSV_0-1734467904383.png

 

It's a simple operation, but this is how I am calling the addGroupUser endpoint through the .net sdk.

 

 

            var childGroupUser = new GroupUser
            {
                Identifier = "[ServicePrincipalObjectId]",//not the client id.  Would be nice if that was clear in the docs on what identifier is needed...
                GroupUserAccessRight = GroupUserAccessRight.Contributor,//or Viewer or Member gives 400 bad request
                PrincipalType = PrincipalType.App,
                Profile = new ServicePrincipalProfile{
                    Id=[ServicePrincipalProfileObjectId]
                }
            };

            Guid groupId = Guid.Parse("[workspaceGuid]");

            await _powerBiClient.Groups.AddGroupUserAsync(groupId, childGroupUser);

 

 

 




1 ACCEPTED SOLUTION
AmosHersch
Microsoft Employee
Microsoft Employee

@JamesCSV Indeed the documentation states that a profile must have Admin access to the workspace, see here:
Use service principal profiles to manage customer data in multitenant apps - Power BI | Microsoft Le...

View solution in original post

3 REPLIES 3
AmosHersch
Microsoft Employee
Microsoft Employee

@JamesCSV Indeed the documentation states that a profile must have Admin access to the workspace, see here:
Use service principal profiles to manage customer data in multitenant apps - Power BI | Microsoft Le...

@AmosHersch Thanks Amos!  I understood that as the initial sp profile needs admin access but not All sp profiles need admin access.  I guess that makes sense since they would need that elevated permissions for the actual embedding part?  Regardless, that clears up my mis-understanding!

yeah that's my understanding also

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.