Power BI Admin Management – Becoming admin of all the workspaces

Imagine being a Power BI admin and not seeing all the workspaces, it could be annoying if somebody ask you to debug something or if you want to download the report to make a backup.

This article is part of an article’s series about how to make a tenant-to-tenant migration, this is why we pass by CSV files. Doing it, we can have more control if we want to make modifications between the steps.

See this article as a small intro to the next one about the security.

Pre-requisite

  • Being administrator of the Power BI tenant
  • PowerBIMgmt Powershell module must be installed
  • Having a “workspaces.csv” file (learn how to create it in the post about about Workspaces)

Add-PowerBIWorkspaceUser

For this example we will use the Add-PowerBIWorkspaceUser Powershell command.

Basically, the Add-PowerBIWorkspaceUser can be used to add a user to a workspace.

Parameters

Several parameters can be passed to this command :

  • -Id (Which is the id of the workspace where you want to add the user)
  • -AccessRight (Member, Admin, Contributor, Viewer)
  • -PrincipalType (Which defined the type of the user that you want to add : App, Group, User)
  • -Identifier (Is the App or Group ID, but it can be the mail address for a user)
  • -Scope (If you don’t specify the scope, you will access uniquely the workspace where you already are but if you specify “Organization”, it will show all the workspaces)

Make the magic happen !

You can imagine to add your email as an admin in a workspace using this command :

Add-PowerBIWorkspaceUser -Scope Organization -Id TheWorkspaceId -AccessRight Admin -PrincipalType User -Identifier MySuper@email.com

Let’s script it !

$adminEmail = 'MySuper@email.com' #Your email address

$workspaceFilePath = 'C:\temp\csv\workspaces.csv' #Path where the "workspaces.csv" file is located

$workspaceCSV = Import-CSV $workspaceFilePath -Delimiter ';' #Import the csv file into a variable

Connect-PowerBIServiceAccount #Connect to Power BI Service

foreach($workspace in $workspaceCSV){ #Loop through the CSV

    Add-PowerBIWorkspaceUser -Scope Organization -Id $workspace.workspaceId -AccessRight Admin -PrincipalType User -Identifier $adminEmail #Add your email as an admin for the current workspace :-)
 
}
Disconnect-PowerBIServiceAccount #Disconnect from Power BI Service

And here you are ! Now if you go to Power BI Service you will be able to access all the workspace (but not the personal ones 🙂 )

Share