Backtrack:  
 
by lunarg on March 20th 2020, at 16:02

With the strong increase in hackers targeting Office 365 tenants, it may be useful to see who has Global Administrator access in your tenant. This can be done either via the Office 365 Portal but also through Powershell.

Note: be sure to install the required Powershell cmdlets before attempting this.

Connect to your Office 365 tenant:

Connect-MsolService

To retrieve a list of users with the Global Administrator role, run this:

Get-MsolRoleMember -RoleObjectId $(Get-MsolRole -RoleName "Company Administrator").ObjectId | Select DisplayName,EmailAddress

You can append Export-Csv to export the list to a CSV-file.