Get-MsolUserRole

Gets administrator roles to which a user belongs.

Syntax

Get-MsolUserRole -ObjectId <Guid> [-TenantId <Guid>] [<CommonParameters>]
Get-MsolUserRole [-TenantId <Guid>] -UserPrincipalName <String> [<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
Required:True
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
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
Required:False
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False

-UserPrincipalName

Specifies the user principal name of the user to retrieve roles for.

Type:String
Required:True
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False