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! Learn more

Reply
Anonymous
Not applicable

Unable to add groups to a workspace using Rest API

l need to use powershell to add a group to an existing workspace

 

Invoke-RestMethod -Method POST -Uri "https://api.powerbi.com/v1.0/myorg/groups/<groupId>/users" -Header @{Authorization = 'Bearer $token'; 'Content-type' = 'application/json'; 'User-Agent' = 'Jenkins'} -Body '{"principalType" = "Group", "groupUserAccessRight"= "Admin", "identifier"= "ID", "displayName"="MyGroupName"}'

 

I keep getting (400) Bad Request error. I am able to add individual users with this body:

{"groupUserAccessRight"= "Admin", "emailAddress"= "john@microsoft.com"}

 

 

What am I doing wrong to add groups?

 

EDIT: The problem seem to be the identifier number I am using. I am not sure how to retrieve the proper one though

1 ACCEPTED SOLUTION
v-jianboli-msft
Community Support
Community Support

Hi @Anonymous ,

 

With PowerShell, you can add an AD group to Power BI Workspace using the Groups – Add Group User API or Add-PowerBIWorkspaceUser Cmdlet.

What you will need:

  • Object ID for the group
    • From Azure Active Directory -> Select Groups -> Select the required Group -> Copy the Object ID
  • Access right to the Workspace for the group
    • Level of Access you want to grant to the Workspace (
      Member, Admin, Contributor, Viewer )
  • The PrincipalType
    • The type of Principal you want to add (
      App, Group, User ) For this example, we want to add an AD Security Group, so we will use Group
  • The Workspace ID
    • From Power BI Service -> Select the Workspace -> copy the ID next to Group in the URL.

For more details, please refer to:

ADDING AZURE AD SECURITY GROUP TO POWER BI WORKSPACE USING POWERSHELL - Ruki&#039;s Blog

Power BI Group management using Active Directory roles and PowerShell 

 

Best Regards,

Jianbo Li

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

 

View solution in original post

2 REPLIES 2
v-jianboli-msft
Community Support
Community Support

Hi @Anonymous ,

 

With PowerShell, you can add an AD group to Power BI Workspace using the Groups – Add Group User API or Add-PowerBIWorkspaceUser Cmdlet.

What you will need:

  • Object ID for the group
    • From Azure Active Directory -> Select Groups -> Select the required Group -> Copy the Object ID
  • Access right to the Workspace for the group
    • Level of Access you want to grant to the Workspace (
      Member, Admin, Contributor, Viewer )
  • The PrincipalType
    • The type of Principal you want to add (
      App, Group, User ) For this example, we want to add an AD Security Group, so we will use Group
  • The Workspace ID
    • From Power BI Service -> Select the Workspace -> copy the ID next to Group in the URL.

For more details, please refer to:

ADDING AZURE AD SECURITY GROUP TO POWER BI WORKSPACE USING POWERSHELL - Ruki&#039;s Blog

Power BI Group management using Active Directory roles and PowerShell 

 

Best Regards,

Jianbo Li

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

 

lbendlin
Super User
Super User

The groups need to be mail enabled AD groups.  The ID is  the AD GUID of the group.

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.