Office 365: Find All SharePoint Online Administrators using PowerShell

Requirement: Get All SharePoint Online Administrators of the Office 365 tenant.

How to Check If a User is SharePoint Online Administrator in Office 365?

If you’re a Microsoft 365 administrator, You may want to find all SharePoint Online Administrators in your organization at times. Perhaps you want to check if a specific user has a SharePoint Administrator role or for security auditing purposes to ensure the right people are granted access to manage SharePoint. This guide will show you two different ways to find all the SharePoint Online Administrators in Microsoft 365 quickly and easily. Let’s get started!

To find if a user is a SharePoint Online Administrator, do the following:

  1. Login to Office 365 Admin Center:
  2. Expand Users >> Active Users.
  3. Use the Search and the user. Click on the user from the results grid, which opens user properties.
  4. On the user properties page, under “Roles”, You’ll find “SharePoint Administrator”.
    get sharepoint administrators in microsoft 365

While these steps are simple, it would be cumbersome to go to each user’s properties and check if they have a SharePoint Administrator role, isn’t it?

PowerShell to Get a List of SharePoint Online Administrators

As a second method, Let me show you the PowerShell script to find all SharePoint Online administrators in your tenant. This PowerShell script lists all SharePoint Administrators from Office 365 environment. Use the Azure AD PowerShell module to execute this script.

#Connect to Azure AD

#Get SharePoint Online Administrators Role
$RoleID = (Get-MsolRole -RoleName "SharePoint Administrator").ObjectID

#Get All Users with SharePoint Admin Role 
Get-MsolRoleMember -RoleObjectId $RoleID | Format-table -AutoSize

This script prompts for login and gets you all SharePoint Administrators of the Microsoft 365 tenant.

get sharepoint administrators in office 365 sharepoint online

Get All SharePoint Online Administrators using Azure AD PowerShell

Similarly, to get all SharePoint Administrators from Microsoft 365 tenants, use this Azure AD PowerShell script:

#Connect to Azure AD

#Get the Role
$RoleName="SharePoint Administrator"
$Role = Get-AzureADDirectoryRole | Where {$_.DisplayName -eq $RoleName}

#Get All users with the Role
$RoleAssignments = Get-AzureADMSRoleAssignment -Filter "roleDefinitionId eq '$($Role.ObjectId)'"

$RoleAssignments | ForEach-Object {
    $User = Get-AzureADObjectByObjectId -ObjectIds $_.PrincipalId
    If($User.ObjectType -eq "User") {
        $User | Select-Object DisplayName,UserPrincipalName,ObjectType

In conclusion, retrieving a list of all SharePoint Administrators in a Microsoft 365 tenant is straightforward using PowerShell. As a Microsoft 365 administrator, it is important to know who has been granted Site Administrator permissions within your tenant. You can retrieve all SharePoint Administrators from your tenant with the steps explained in this article.

To add a SharePoint Online administrator, use: How to Add a SharePoint Online Administrator?

Salaudeen Rajack

Salaudeen Rajack - SharePoint Expert with Two decades of SharePoint Experience. Love to Share my knowledge and experience with the SharePoint community, through real-time articles!

2 thoughts on “Office 365: Find All SharePoint Online Administrators using PowerShell

  • Hello and many thanks for this article !
    You should update the script by removing “service” and just keep “SharePoint Administrator” to get the correct role name.

    #Get SharePoint Online Administrators Role
    $RoleID = (Get-MsolRole -RoleName “SharePoint Administrator”).ObjectID

    • True! It was “SharePoint Service Administrator” in Azure AD PowerShell and Microsoft 365 Admin center (as shown in the screenshots), and now I see it’s renamed to the “SharePoint Administrator” role!


Leave a Reply

Your email address will not be published. Required fields are marked *