Skip to content

Instantly share code, notes, and snippets.

@SQLvariant
Last active August 31, 2019 16:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SQLvariant/f4b2dea2fd42de31395317bafdb17c03 to your computer and use it in GitHub Desktop.
Save SQLvariant/f4b2dea2fd42de31395317bafdb17c03 to your computer and use it in GitHub Desktop.
Copy Users & Groups from one Power BI Workspace to another
<# 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