Add user(s) to multiple Power BI workspaces quickly

A few days ago I had to add a new team member to more that 50 workspaces. I started dying inside just thinking of going to each workspace and add it using the portal ui.

Here’s a little snippet that saved me a few hundred clicks:


$workspaces = Get-PowerBIWorkSpace

$user = ""

foreach($workspace in $workspaces)
    Write-Host "Adding User to : " $workspace.Name
        Add-PowerBIWorkspaceUser -Id $workspace.Id -UserPrincipalName $user -AccessRight Member
        Write-Host "Message: [$($_.Exception.Message)"] -ForegroundColor Red

Adapt it to your needs.

Have fun!