List Global Administrators In Office 365 And Azure AD Using PowerShell

In this blog post, I will show to list all the Global Administrators in Office 365 and Azure AD using PowerShell and Cloud Shell.

A few years ago, I had published a blog post on how to do using the old Azure AD PowerShell Module (Msonline).

Since then, The new Azure AD PowerShell module has been released and now, you don’t need to install it on your machine because you can run it directly from Cloud Shell.

Connect and Run Commands

To get started, I have connected to Cloud Shell and using the following command to connect to Cloud Shell.

Connect-AzureAD

Next, I will run the command below, which will save the Company Administrator role into a variable.

$admins = Get-AzureADDirectoryRole | where{$_.displayname -like "company administrator"}

The following command will list all the Global Administrators in Office 365 and Azure AD.

Get-AzureADDirectoryRoleMember -ObjectId $admins.ObjectId

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.