How to list all Power BI Service Administrators in Azure with Powershell? Just a small reminder for myself (and you 🙂 ):
Someone is Power BI Service Administrator when she has one of the following roles:
- Power BI Service Administrator
- Global Administrator
List Power BI Service Administrators with Powershell
The following command lists all members Power BI Service Administrator role. In blue I create a filter to extract the GUID of the Power BI Service Administrator role. In red I select this role object. Then in green I command to return all members of the specified role.
PS C:\Users\ITExperience> Get-AzureADDirectoryRole -ObjectID (Get-AzureADDirectoryRole | Where-Object {$_.Displayname -like “*Power BI Service Administrator*”}).ObjectID | Get-AzureADDirectoryRoleMember
Note: if you are not yet logged on to Azure’s Powershell, you are reminded to do so.
Get-AzureADDirectoryRole : You must call the Connect-AzureAD cmdlet before calling any other cmdlets.
To list all Global Administrators, I do the same trick, but then the other way around. A little bit shorter, but it is in fact the same result
PS C:\Users\ITExperience> Get-AzureADDirectoryRoleMember -ObjectId (Get-AzureADDirectoryRole | Where-Object {$_.DisplayName -eq ‘Company Administrator’}).ObjectID
To add users to the role, refer to https://docs.microsoft.com/en-us/power-bi/service-admin-role