The Get-MsolUserRole cmdlet in PowerShell gets the administrator roles to which a user belongs in Microsoft Office 365. This command returns roles that the user is a member of through security group membership.
The syntax to get administrator roles to which a user belongs in Azure Active Directory is given below.
Get-MsolUserRole
-ObjectId <Guid>
-UserPrincipalName <String>
[-TenantId <Guid>]
[<CommonParameters>]
In this article, we will discuss how to get all of the administrator roles to which the specified user belongs using the Get-MsolUserRole cmdlet in PowerShell.
How to Get Administrator Roles a User belongs in
To get administrator roles a user belongs to in Office 365, use the Get-MsolUserRole command with the -UserPrincipalName
parameter. The -UserPrincipalName
parameter is used to specify the user principal name of the user to retrieve roles for.
Get-MsolUserRole -UserPrincipalName "[email protected]"
This command retrieves all administrator roles that the user with the user principal name “[email protected]” belongs to.
Conclusion
I hope the above article on how to use the Get-MsolUserRole cmdlet in PowerShell to retrieve the administrator roles for the users is a member of in Azure Active Directory is helpful to you.
You can find more topics about PowerShell Active Directory commands and PowerShell basics on the ShellGeek home page.