Forum Discussion
Add-PowerBIWorkspaceUser - adding group to Workspace
Hi,
I am trying to automate different PowerBI tasks using a service principal.
I can create new PowerBI Workspaces and the service principal is an admin on the Workspace.
Afterwards I would like to add a synchronised AD group as contributor, with the following:
Add-PowerBIWorkspaceUser -Id <ID of PowerBI Workspace> -PrincipalType Group -AccessRight Contributor -Identifier <Object Id of AD group>
I get the error:
Add-PowerBIWorkspaceUser : Operation returned an invalid status code 'NotFound'
Am I missing something - or doing it wrong?
- Anonymous4 years ago
HI ,
Below worked like a charm :Add-PowerBIWorkspaceUser -Scope Organization -Id <workspaceid> -UserEmailAddress [email protected] -AccessRight Admin
Ensure: You have Admin Rights to add the user. I tested it just now my user from which running API has Admin Rights on the workspace and its Premium ( to be considered if you are adding free user )
Waiting for update 🙂
CHeers
Mahak
10 Replies
- AnonymousNot applicable
Did you tried :
Add-PowerBIWorkspaceUser -Scope Individual -Id myWorkSpaceIDasString -Identifier myIdentifierAsString -AccessRight Admin -PrincipalType Group
Regards,Mahak
- AnonymousNot applicable
Also, there is a very nice blog/code available for Automation: https://github.com/microsoft/powerbi-powershell/blob/master/src/Modules/Workspaces/Commands.Workspaces/help/Add-PowerBIWorkspaceUser.md which can help more. Tried and Tested.
- kimlauritsFrequent Visitor
I tried it, but I get the same error:
Add-PowerBIWorkspaceUser : Operation returned an invalid status code 'NotFound'
It works when I add a user to a Workspace:
Add-PowerBIWorkspaceUser -Id <Workspace Id> -AccessRight Contributor -Identifier <User UPN> -PrincipalType User