Get All SharePoint Online Administrators in Office 365 using PowerShell

Requirement: Get a list of All users with SharePoint Online Administrator Role.

How to Get All SharePoint Online Administrators in Office 365?
To view all existing SharePoint admins, do the following:
  • Login to Microsoft Admin Center https://admin.microsoft.com
  • Click on "Show All" in the left navigation >> Click on "Roles" link
  • Under Roles click on "SharePoint Admin" >> Click on the "Assigned Admins" tab in the details pane.
    get all sharepoint online administrators in office 365
This gets you all SharePoint Admins of the tenant. Please note, Global admin rights include the SharePoint Online Admin role as well!

Get All SharePoint Online Administrator in Office 365 tenant using PowerShell:
As a regular security audit, we wanted to generate a report of who is having admin rights on SharePoint Online. So, Here is the PowerShell to get all SharePoint Online Administrators.
#Connect to Azure AD
Connect-AzureAD
 
#Parameters
$RoleName="SharePoint Service Administrator"

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

#Get All Members of the Role
Get-AzureADDirectoryRoleMember -ObjectId $Role.ObjectId | Select DisplayName, UserPrincipalName
This script would give a prompt to enter your credentials.

Here is my other post on adding new SharePoint Online Administrators in Office 365: How to Add New SharePoint Online Administrator?
Get All SharePoint Online Administrators in Office 365 using PowerShell Get All SharePoint Online Administrators in Office 365 using PowerShell Reviewed by Salaudeen Rajack on June 15, 2019 Rating: 5

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.