Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.