Remove-AzureADOAuth2PermissionGrant
Removes an oAuth2PermissionGrant.
Syntax
Default (Default)
Remove-AzureADOAuth2PermissionGrant
-ObjectId <String>
[-InformationAction <ActionPreference>]
[-InformationVariable <String>]
[<CommonParameters>]
Description
The Remove-AzureADOAuth2PermissionGrant cmdlet removes an oAuth2PermissionGrant object in Azure Active Directory (AD).
Examples
Example 1: Remove an OAuth2 permission grant
PS C:\> $SharePointSP = Get-AzureADServicePrincipal | Where-Object {$_.DisplayName -eq "Microsoft.SharePoint"}
PS C:\> $SharePointOA2AllSitesRead = Get-AzureADOAuth2PermissionGrant | Where-Object {$_.ResourceId -eq $SharePointSP.ObjectId} | Where-Object {$_.Scope -eq "AllSites.Read"}
PS C:\> Remove-AzureADOAuth2PermissionGrant -ObjectId $SharePointOA2AllSitesRead.ObjectId
The first command gets a service principal that matches the specified display name by using the Get-AzureADServicePrincipal (./Get-AzureADServicePrincipal.md)cmdlet. The command stores the result in the $SharePointSP variable.
The second command gets certain permission grants by using the Get-AzureADOAuth2PermissionGrant (./Get-AzureADOAuth2PermissionGrant.md)cmdlet. The command stores the result in the $SharePointOA2AllSitesRead variable.
The final command removes the permission grant in $SharePointOA2AllSitesRead.
Parameters
-InformationAction
Specifies how this cmdlet responds to an information event. The acceptable values for this parameter are:
- Continue
- Ignore
- Inquire
- SilentlyContinue
- Stop
- Suspend
Parameter properties
Type: | ActionPreference |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Aliases: | infa |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-InformationVariable
Specifies an information variable.
Parameter properties
Type: | String |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Aliases: | iv |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-ObjectId
Specifies the ID of an oAuth2PermissionGrant object in Azure AD.
Parameter properties
Type: | String |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | True |
Value from pipeline: | True |
Value from pipeline by property name: | True |
Value from remaining arguments: | False |
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.