Last active
August 31, 2019 16:12
-
-
Save SQLvariant/f4b2dea2fd42de31395317bafdb17c03 to your computer and use it in GitHub Desktop.
Copy Users & Groups from one Power BI Workspace to another
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# Clone Users from one Workspace to another | |
Start by specifying the Target Workspace | |
Then use the Out-GridView cmdlet to choose the Source Workspce to copy the users & roles from. | |
https://powerbi.microsoft.com/en-us/blog/announcing-apis-and-powershell-cmdlets-for-power-bi-administrators/ #> | |
$TargetWorkspace = Get-PowerBIWorkspace -Name 'New QA Workspace'; | |
(Get-PowerBIWorkspace | | |
Out-GridView -PassThru | | |
foreach { Get-PowerBIWorkspace -Id $_.Id -Scope Organization }).Users | | |
WHERE { $_.AccessRight -ne 'Viewer' } | | |
foreach { | |
Add-PowerBIWorkspaceUser -Id $TargetWorkspace.Id -UserPrincipalName $_.UserPrincipalName -AccessRight $_.AccessRight | |
}; | |
# Verify users & access rights were successfully copied: | |
(Get-PowerBIWorkspace -Id $TargetWorkspace.Id -Scope Organization).Users |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment