Forum Discussion

misterMethod's avatar
misterMethod
Frequent Visitor
3 years ago

Using PowerShell to add AD Security Group to Workspace.

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 "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.
Add-PowerBIWorkspaceUser -Scope Organization -Id  <WorkspaceId> -Identifier <AD Group GUI> -AccessRight Viewer -PrincipalType Group

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.

2 Replies