Simplify user tasks like bulk creation, updates, password resets, deletions, license checks & more — all from one place.
🚀 Launch ToolkitMicrosoft Entra ID (formerly known as Azure Active Directory) provides a rich set of directory roles to help you manage access and permissions at scale. Whether it's built-in roles like Global Administrator or custom-defined roles tailored to your organization’s needs, it’s important to be able to retrieve, review, and understand these roles effectively.
This blog introduces the Get-MgRoleManagementDirectoryRoleDefinition cmdlet — your go-to command for fetching directory role definitions using Microsoft Graph PowerShell.
Get-MgRoleManagementDirectoryRoleDefinition is a Microsoft Graph PowerShell cmdlet that allows you to list all the role definitions available in your tenant. These definitions represent all the available directory-level roles, including:
Each role definition includes properties like:
There are several reasons why administrators and auditors would want to use this cmdlet:
Get-MgRoleManagementDirectoryRoleDefinition
With All Switch:
Get-MgRoleManagementDirectoryRoleDefinition -All
The -All switch is useful when you want to retrieve every role definition across your tenant without pagination.
Get-MgRoleManagementDirectoryRoleDefinition -All |
Select-Object Id, DisplayName, Description, IsBuiltIn
This gives you a comprehensive view of every role available in your tenant.
$roleDefinitions = Get-MgRoleManagementDirectoryRoleDefinition -All
$roleDefinitions | Where-Object { $_.IsBuiltIn -eq $false }
Use this when you're looking for roles like “Global Administrator” or anything containing "Global".
$roleDefinitions = Get-MgRoleManagementDirectoryRoleDefinition -All
$roleDefinitions | Where-Object { $_.IsBuiltIn -eq $false }
This filters out built-in roles, showing only the custom directory roles defined in your organization.
Currently, -Filter is not supported directly for this cmdlet. Use the -All switch and pipe to Where-Object in PowerShell, as shown in the examples.
Each role object has an IsBuiltIn property:
The Get-MgRoleManagementDirectoryRoleDefinition cmdlet is an essential tool for discovering, understanding, and auditing directory roles in Microsoft Entra ID. Whether you're running a security review, building automation, or creating a role assignment interface, this cmdlet gives you the foundational knowledge needed to work with Azure AD roles intelligently.
Start exploring your directory roles today — and combine this with Get-MgRoleManagementDirectoryRoleAssignment for a complete role-to-user mapping!
Did You Know? Managing Microsoft 365 applications is even easier with automation. Try our Graph PowerShell scripts to automate tasks like generating reports, cleaning up inactive Teams, or assigning licenses efficiently.
Ready to get the most out of Microsoft 365 tools? Explore our free Microsoft 365 administration tools to simplify your administrative tasks and boost productivity.
© Your Site Name. All Rights Reserved. Design by HTML Codex