Get-​Azure​AD​User​OAuth2​Permission​Grant

Gets an oAuth2PermissionGrant object.

Syntax

Get-AzureADUserOAuth2PermissionGrant
   [-All <Boolean>]
   -ObjectId <String>
   [-Top <Int32>]
   [<CommonParameters>]

Description

The Get-AzureADUserOAuth2PermissionGrant cmdlet gets an oAuth2PermissionGrant object for the specified user in Azure Active Directory (AD).

Examples

Example 1: Retrieve the OAuth2 permission grants for a user

PS C:\> $UserId = (Get-AzureADUser -Top 1).ObjectId
PS C:\> Get-AzureADUserOAuth2PermissionGrant -ObjectId $UserId

The first command gets the ID of an Azure AD user by using the Get-AzureADUser cmdlet. The command stores the value in the $UserId variable.

The second command gets the OAuth2 permission grants for the user identified by $UserId.

Required Parameters

-ObjectId

Specifies the ID (as a UPN or ObjectId) of a user in Azure AD.

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

Optional Parameters

-All

If true, return all permission grants. If false, return the number of objects specified by the Top parameter

Type:Boolean
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName, ByValue)
Accept wildcard characters:False
-Top

Specifies the maximum number of records to return.

Type:Int32
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName, ByValue)
Accept wildcard characters:False