How to get a list of directory role assignments in Microsoft Entra ID

Tracking directory role assignments in Microsoft Entra ID is crucial for knowing who holds elevated access and maintaining least-privilege compliance. This can get complicated when numerous users, groups, and service principals exist across different environments with varying access levels. The good news is that dependable tools and methods are available to review and manage these role assignments effectively.

  • M365 admin center
  • PowerShell
  • ADManager Plus
 

How to get a list of directory role assignments in Microsoft Entra ID using the Microsoft Entra admin center

  1. Sign in to the Microsoft Entra ID admin center.
  2. Go to Entra ID > Roles & admins.
  3. In the list of all directory roles, select the role you want to check, then open Assignments to view users or groups assigned.
  4. Click Download assignments at the top to export the list.
A comprehensive list of all the directory role assignments in the Microsoft Entra admin center.

How to get a directory role assignments list using Windows PowerShell

  • Connect to Microsoft Graph PowerShell.
    Connect-MgGraph -Scopes "Directory.Read.All RoleManagement.Read.Directory"
  • Get all directory role assignments.
    Get-MgDirectoryRoleAssignment
  • You can also filter by the user assigned to the role.
    Get-MgDirectoryRoleAssignment -Filter "userId eq '<ObjectId>'"

Example

Retrieve the directory role assignments for a user with object ID e9b1f3a1-1234-4d56-9abc-0def12345678.

Example query:

Connect-MgGraph -Scopes "Directory.Read.All RoleManagement.Read.Directory"
Get-MgDirectoryRoleAssignment -Filter "principalId eq 'e9b1f3a1-1234-4d56-9abc-0def12345678'"

Example output:

Id: 4f3c2d1e-7890-4bcd-8a12-3456789def01
PrincipalId: e9b1f3a1-1234-4d56-9abc-0def12345678
PrincipalDisplayName: John Doe
PrincipalType: User
RoleDefinitionId: 62e90394-69f5-4237-9190-012177145e10
RoleDisplayName: Global Administrator
DirectoryScopeId: /

How to get directory role assignments in Microsoft Entra ID using Microsoft Graph PowerShell

The syntax is as follows:

Get-MgRoleManagementDirectoryRoleAssignment
[-ExpandProperty <string[]>]
[-Property <string[]>]
[-Filter <string>]
[-Search <string>]
[-Skip <int>]
[-Sort <string[]>]
[-Top <int>]
[-ResponseHeadersVariable <string>]
[-Break]
[-Headers <IDictionary>]
[-HttpPipelineAppend <SendAsyncStep[]>]
[-HttpPipelinePrepend <SendAsyncStep[]>]
[-Proxy <uri>]
[-ProxyCredential <pscredential>]
[-ProxyUseDefaultCredentials]
[-PageSize <int>]
[-All]
[-CountVariable <string>]
[<CommonParameters>]

Example

List all role assignments where the principal is a service principal with object ID 72c3f3f9-2a17-4f55-b4b3-efb7cdb3f82e.

Example query:

Connect-MgGraph -Scopes "RoleManagement.Read.Directory"
Get-MgRoleManagementDirectoryRoleAssignment -Filter "principalId eq '72c3f3f9-2a17-4f55-b4b3-efb7cdb3f82e'"

Example output:

Id: b3f2c1d4-5678-49ef-9abc-0d12345ef678
PrincipalId: 72c3f3f9-2a17-4f55-b4b3-efb7cdb3f82e
PrincipalDisplayName: TestBot
PrincipalType: ServicePrincipal
RoleDefinitionId: 62e90394-69f5-4237-9190-012177145e10
RoleDisplayName: Global Reader
DirectoryScopeId: /

This output shows that the service principal with the ID 72c3f3f9-2a17-4f55-b4b3-efb7cdb3f82e, which is also displayed as TestBot, has been assigned the Global Reader role. The RoleDefinitionId points to that role definition, and the DirectoryScopeId set to / means the assignment applies across the entire tenant, not just a limited scope.

Streamlining Microsoft 365 management and reporting

ADManager Plus helps Microsoft 365 admins manage users, groups, and access efficiently through a centralized interface.

User and group management

Create and modify users and groups individually or in bulk. Ensure the right people have access to the right resources without leaving orphaned accounts or unused groups.

Bulk group modifications

Quickly update multiple groups at once, change memberships, adjust settings, or reorganize groups to match evolving business needs.

Comprehensive reporting

Access over 200 prebuilt reports, including group memberships, license usage, and user activity. Gain full visibility to support audits, track access patterns, and identify anomalies.

Access reviews for group memberships

Regularly conduct access reviews. Identify unnecessary privileges, remove outdated memberships, and maintain least-privilege access across your tenant.

Delegation and workflows

Use role-based delegation to assign day-to-day admin tasks safely. Empower teams to manage groups and users while maintaining oversight and control.

Automation

Automate repetitive tasks like user provisioning, group updates, and license management. Reduce manual effort and ensure processes are consistent and timely.

Important tips

  • Review assignment scopes

    Roles can be granted at different levels, so always review the scope to understand the exact boundaries of each assignment.

  • Leverage Privileged Identity Management (PIM) for elevated roles

    With Microsoft Entra ID P2, you can manage eligible versus active role assignments through PIM. This adds just-in-time access, approval workflows, and time limits to strengthen control over elevated directory roles.

  • Generate detailed access and compliance reports

    Use reporting tools to consolidate directory role assignments, privileged access, and group memberships into clear, actionable reports. These help uncover over-privileged accounts, monitor changes, and simplify compliance audits.

Manage Microsoft 365 smarter with ADManager Plus

FAQ

Microsoft recommends keeping the total number of privileged role assignments in a tenant to around 60. This recommendation helps maintain a secure and manageable environment by limiting the number of users or groups with elevated administrative permissions across the organization.

You can use the Get-MgRoleManagementDirectoryRoleAssignment cmdlet in Microsoft Graph PowerShell to retrieve all directory role assignments for a specific principal (user, group, or service principal) in Microsoft Entra ID.

Example to get all role assignments for a principal by filtering on principalId:

Get-MgRoleManagementDirectoryRoleAssignment -Filter "principalId eq '<PrincipalObjectId>'

This will return a list of unified role assignment objects representing the directory roles assigned to the principal, including role ID, principal ID, and scope.

Get-MgRoleManagementDirectoryRoleAssignment provides a unified and scalable way to see who holds which roles at the directory scope, supporting governance and access audits.

For more detailed information, including role definition names or principal details, combine this command with other Graph cmdlets like Get-MgRoleManagementDirectoryRoleDefinition and Get-MgUser or Get-MgGroup.

To export and report all admin role memberships, retrieve all directory roles:

$roles = Get-MgRoleManagementDirectoryRoleDefinition

For each role, get its members:

foreach ($role in $roles) {
$members = Get-MgRoleManagementDirectoryRoleMember -RoleDefinitionId $role.Id
# Output or export members, e.g. to CSV
}
The one-stop solution to Active Directory Management and Reporting
Email Download Link Email the ADManager Plus download link