Get-MsolUserRole
Gets administrator roles to which a user belongs.
Syntax
Get-MsolUserRole
-ObjectId <Guid>
[-TenantId <Guid>]
[<CommonParameters>]
Get-MsolUserRole
-UserPrincipalName <String>
[-TenantId <Guid>]
[<CommonParameters>]
Description
The Get-MsolUserRole cmdlet gets all of the administrator roles to which the specified user belongs. This cmdlet will also return roles that the user is a member of through security group membership.
Examples
Example 1: Get user groups
PS C:\> Get-MsolUserRole -UserPrincipalName "davidchew@contoso.com"
This command retrieves all groups that davidchew@contoso.com is a member of.
Parameters
-ObjectId
Specifies the unique ID of the user to retrieve roles for.
Type: | Guid |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-TenantId
Specifies the unique ID of the tenant on which to perform the operation. The default value is the tenant of the current user. This parameter applies only to partner users.
Type: | Guid |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-UserPrincipalName
Specifies the user principal name of the user to retrieve roles for.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |