In this Azure article, we will discuss the syntax and usage of the Get-AzureADDirectoryRole PowerShell command with examples of the usage of this command.
Table of Contents
Get-AzureADDirectoryRole
You can use this PowerShell command to retrieve the details of a directory role from your Azure AD.
Syntax
Below is the syntax of the Get-AzureADDirectoryRole PowerShell command.
Get-AzureADDirectoryRole
Get-AzureADDirectoryRole
-ObjectId <String>
Let’s discuss a few examples of how to use the Get-AzureADDirectoryRole PowerShell command.
Example-1:
You can execute the below PowerShell command to get all the directory role details from your Azure AD.
Connect-AzureAD -TenantId 5d9d690a-0310-474d-ae8b-42df2d549228
Get-AzureADDirectoryRole
Note: You must call Connect-AzureAD along with the TenantId parameter before calling the Get-AzureADDirectoryRole PowerShell command.
After executing the above command, I got the expected output as below.
PS C:\WINDOWS\system32> Connect-AzureAD -TenantId 5d9d690a-0310-474d-ae8b-42df2d549228
Get-AzureADDirectoryRole
Account Environment TenantId TenantDomai
n
------- ----------- -------- -----------
fewlines4biju@hotmail.com AzureCloud 5d9d690a-0310-474d-ae8b-42df2d549228 fewlines...
DeletionTimestamp :
ObjectId : 09b0fe44-95d0-4aa2-8cb2-23b92c054696
ObjectType : Role
Description : Can manage all aspects of Azure AD and Microsoft services that
use Azure AD identities.
DisplayName : Global Administrator
IsSystem : True
RoleDisabled : False
RoleTemplateId : 62e90394-69f5-4237-9190-012177145e10
DeletionTimestamp :
ObjectId : 64fe484e-26b2-4c61-9eaf-cf0bfe542b3e
ObjectType : Role
Description : Can read basic directory information. Commonly used to grant
directory read access to applications and guests.
DisplayName : Directory Readers
IsSystem : True
RoleDisabled : False
RoleTemplateId : 88d8e3e3-8f55-4a1e-953a-9b9898b8876b
You can see the same output in the below screenshot.

Example-2:
You can execute the below PowerShell command to retrieve details of the specified Object ID of the Azure AD role.
PS C:\WINDOWS\system32> Connect-AzureAD -TenantId 5d9d690a-0310-474d-ae8b-42df2d549228
Get-AzureADDirectoryRole -ObjectId 64fe484e-26b2-4c61-9eaf-cf0bfe542b3e
After executing the above PowerShell command, I got the expected output as below.

You can also check out below video tutorial on the Get-AzureADDirectoryRole command.
Final Thoughts
Well, in this Azure PowerShell article, we discussed the syntax and usage of the Get-azureaddirectoryrole PowerShell command with examples of how to use the Get-azureaddirectoryrole PowerShell command. Thanks for reading this article !!!