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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
mr_method
Regular Visitor

Error when using PowerShell to add AD Security Group to Workspace.

Using PowerShell to add AD Security Group to Workspace.
Wednesday

HI All,
     I am trying Add Active Directory Security Group to workspace using PowerShell. 
I can do it manually ( I am Global Admin on the tenant)
I can add specific user using the PowerShell cmdlet
# Authenticate to the Power BI service
Connect-PowerBIServiceAccount
"ADD-PowerBIWorkspaceUser -id <workspaceId> -UserEmailAddress - <UserPrincipalName> - AccessRight <AccessRight>" 
The issue is when I try using th same command to Add AD Security Group (Email enabled) I get an error saying 

Here is the cmdlet.
# Authenticate to the Power BI service
Connect-PowerBIServiceAccount
Add-PowerBIWorkspaceUser -Scope Organization -Id  <WorkspaceId> -Identifier <AD Group GUI> -AccessRight Viewer -PrincipalType Group
And Here is the error I am getting
Add-PowerBIWorkspaceUser: Operation returned an invalid status code 'BadRequest'
and using the Resolve-PowerBIError cmdlet 
I get "InvalidRequest","message":"Parameter PrincipalType or Identifier is missing or invalid"
I am wondering if there is something I am missing.
P.S. On V2 workspace. Using connect-PowerBIServiceAccount to connect to the powerbi.com.

Thanks in advance.

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

Hi , @mr_method

I use your cmdlet in PowerShell and return the same error:

vyueyunzhmsft_0-1682386498013.png

The warning message "Only preview workspaces are supported when -Scope Organization is specified" indicates that the workspace you are trying to add the user to is not a preview workspace.

The -Scope Organization parameter is used to specify that the workspace is an organizational workspace, which is a new type of workspace that is currently in preview. Preview workspaces are not yet generally available and are subject to change.

 

For now , you can just omit the -Scope Organization parameter to test :
Add-PowerBIWorkspaceUser -Id "workspace ID" -Identifier "Group Object ID" -AccessRight Viewer -PrincipalType Group

And the Group Object ID you can get in Azure Portal:

vyueyunzhmsft_1-1682386618043.png

And then you can add it in workspace successfully:

vyueyunzhmsft_0-1682386733785.png

 

 

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

1 REPLY 1
v-yueyunzh-msft
Community Support
Community Support

Hi , @mr_method

I use your cmdlet in PowerShell and return the same error:

vyueyunzhmsft_0-1682386498013.png

The warning message "Only preview workspaces are supported when -Scope Organization is specified" indicates that the workspace you are trying to add the user to is not a preview workspace.

The -Scope Organization parameter is used to specify that the workspace is an organizational workspace, which is a new type of workspace that is currently in preview. Preview workspaces are not yet generally available and are subject to change.

 

For now , you can just omit the -Scope Organization parameter to test :
Add-PowerBIWorkspaceUser -Id "workspace ID" -Identifier "Group Object ID" -AccessRight Viewer -PrincipalType Group

And the Group Object ID you can get in Azure Portal:

vyueyunzhmsft_1-1682386618043.png

And then you can add it in workspace successfully:

vyueyunzhmsft_0-1682386733785.png

 

 

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.

Top Solution Authors