- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
HI ,
Below worked like a charm :
Add-PowerBIWorkspaceUser -Scope Organization -Id <workspaceid> -UserEmailAddress mahak@xxxxxxxxx.com -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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Did you tried :
Add-PowerBIWorkspaceUser -Scope Individual -Id myWorkSpaceIDasString -Identifier myIdentifierAsString -AccessRight Admin -PrincipalType Group
Regards,Mahak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Also, there is a very nice blog/code available for Automation: https://github.com/microsoft/powerbi-powershell/blob/master/src/Modules/Workspaces/Commands.Workspac... which can help more. Tried and Tested.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
HI ,
Below worked like a charm :
Add-PowerBIWorkspaceUser -Scope Organization -Id <workspaceid> -UserEmailAddress mahak@xxxxxxxxx.com -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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes - the same works here, when adding a user.
But unfortunately it doesn't work when adding a AD group.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Did you tried the latest code I posted?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Login-PowerBI
#Using AD Security group
$Body = @{
identifier= “add your Odject ID here” #Object ID for the Security group
groupUserAccessRight= “Admin” #Permission for the group to the Workspace
principalType= “Group” #The type of Principal(App, Group, User)
}
$BodyJSON=$Body | ConvertTo-Json
Invoke-PowerBIRestMethod -Method post -Url “/groups/Add your group Id here/users” -Body $BodyJSON #Workspace ID
Can you trythis too.
This worked for me to add my Functional Email Group to the same workspace.
Cheers
Mahak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
#Using AD Security group
$Body = @{
identifier= “<groupidfromAzureAD>” #Object ID for the Security group
groupUserAccessRight= “Admin” #Permission for the group to the Workspace
principalType= “Group” #The type of Principal(App, Group, User)
}
$BodyJSON=$Body | ConvertTo-Json
Invoke-PowerBIRestMethod -Method post -Url “/groups/<workspaceIDpastehere>/users” -Body $BodyJSON #Workspace ID
Cheers
Mahak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, that seems to work well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Awesome. Could you please mark it as Solution Provided i.e. my answer.
Cheers
Mahak
Helpful resources
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Microsoft Fabric Community Conference 2025
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
Subject | Author | Posted | |
---|---|---|---|
08-02-2024 03:08 AM | |||
09-06-2024 12:48 AM | |||
03-22-2019 01:04 PM | |||
10-14-2024 05:17 AM | |||
08-14-2018 08:32 AM |
User | Count |
---|---|
26 | |
24 | |
13 | |
10 | |
9 |
User | Count |
---|---|
50 | |
41 | |
24 | |
19 | |
16 |