Remove-AzureRmKeyVaultAccessPolicy

Removes all permissions for a user or application from a key vault.

Syntax

Remove-AzureRmKeyVaultAccessPolicy
      [-VaultName] <String>
      [[-ResourceGroupName] <String>]
      -UserPrincipalName <String>
      [-PassThru]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-AzureRmKeyVaultAccessPolicy
      [-VaultName] <String>
      [[-ResourceGroupName] <String>]
      -ObjectId <String>
      [-ApplicationId <Guid>]
      [-PassThru]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-AzureRmKeyVaultAccessPolicy
      [-VaultName] <String>
      [[-ResourceGroupName] <String>]
      -ServicePrincipalName <String>
      [-PassThru]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-AzureRmKeyVaultAccessPolicy
      [-VaultName] <String>
      [[-ResourceGroupName] <String>]
      -EmailAddress <String>
      [-PassThru]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-AzureRmKeyVaultAccessPolicy
      [-VaultName] <String>
      [[-ResourceGroupName] <String>]
      [-EnabledForDeployment]
      [-EnabledForTemplateDeployment]
      [-EnabledForDiskEncryption]
      [-PassThru]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-AzureRmKeyVaultAccessPolicy
      [-InputObject] <PSKeyVault>
      -ObjectId <String>
      [-ApplicationId <Guid>]
      [-PassThru]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-AzureRmKeyVaultAccessPolicy
      [-InputObject] <PSKeyVault>
      -ServicePrincipalName <String>
      [-PassThru]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-AzureRmKeyVaultAccessPolicy
      [-InputObject] <PSKeyVault>
      -UserPrincipalName <String>
      [-PassThru]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-AzureRmKeyVaultAccessPolicy
      [-InputObject] <PSKeyVault>
      -EmailAddress <String>
      [-PassThru]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-AzureRmKeyVaultAccessPolicy
      [-InputObject] <PSKeyVault>
      [-EnabledForDeployment]
      [-EnabledForTemplateDeployment]
      [-EnabledForDiskEncryption]
      [-PassThru]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-AzureRmKeyVaultAccessPolicy
      [-ResourceId] <String>
      -ObjectId <String>
      [-ApplicationId <Guid>]
      [-PassThru]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-AzureRmKeyVaultAccessPolicy
      [-ResourceId] <String>
      -ServicePrincipalName <String>
      [-PassThru]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-AzureRmKeyVaultAccessPolicy
      [-ResourceId] <String>
      -UserPrincipalName <String>
      [-PassThru]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-AzureRmKeyVaultAccessPolicy
      [-ResourceId] <String>
      -EmailAddress <String>
      [-PassThru]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-AzureRmKeyVaultAccessPolicy
      [-ResourceId] <String>
      [-EnabledForDeployment]
      [-EnabledForTemplateDeployment]
      [-EnabledForDiskEncryption]
      [-PassThru]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

The Remove-AzureRmKeyVaultAccessPolicy cmdlet removes all permissions for a user or application or for all users and applications from a key vault. Even if you remove all permissions, the owner of the Azure subscription that contains the key vault can add permissions to the key vault. Note that although specifying the resource group is optional for this cmdlet, you should do so for better performance.

Examples

Example 1: Remove permissions for a user

PS C:\> Remove-AzureRmKeyVaultAccessPolicy -VaultName 'Contoso03Vault' -UserPrincipalName 'PattiFuller@contoso.com' -PassThru

Vault Name                       : Contoso03Vault
Resource Group Name              : myrg
Location                         : westus
Resource ID                      : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/resourceGroups/myrg/providers
                                   /Microsoft.KeyVault/vaults/contoso03vault
Vault URI                        : https://contoso03vault.vault.azure.net/
Tenant ID                        : xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx
SKU                              : Standard
Enabled For Deployment?          : False
Enabled For Template Deployment? : False
Enabled For Disk Encryption?     : False
Soft Delete Enabled?             :
Access Policies                  :
                                   Tenant ID                                  : xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx
                                   Object ID                                  : xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx
                                   Application ID                             :
                                   Display Name                               : User Name (username@microsoft.com)
                                   Permissions to Keys                        :
                                   Permissions to Secrets                     :
                                   Permissions to Certificates                : get, create
                                   Permissions to (Key Vault Managed) Storage :


Network Rule Set                 :
                                   Default Action                             : Allow
                                   Bypass                                     : AzureServices
                                   IP Rules                                   :
                                   Virtual Network Rules                      :

Tags                             :

This command removes all the permissions that a user PattiFuller@contoso.com has on the key vault named Contoso03Vault. If -PassThru is specified, the KeyVault object is returned.

Example 2: Remove permissions for an application

PS C:\> Remove-AzureRmKeyVaultAccessPolicy -VaultName 'Contoso03Vault' -ServicePrincipalName 'http://payroll.contoso.com'

This command removes all the permissions that an application has on the key vault named Contoso03Vault. This example identifies the application by using the service principal name registered in Azure Active Directory, http://payroll.contoso.com.

Example 3: Remove permissions for an application by using its object ID

PS C:\> Remove-AzureRmKeyVaultAccessPolicy -VaultName 'Contoso03Vault' -ObjectID 34595082-9346-41b6-8d6b-295a2808b8db

This command removes all the permissions that an application has on the key vault named Contoso03Vault. This example identifies the application by the object ID of the service principal.

Example 4: Remove permissions for the Microsoft.Compute resource provider

PS C:\> Remove-AzureRmKeyVaultAccessPolicy -VaultName 'Contoso03Vault' -ResourceGroupName 'Group14' -EnabledForDeployment

This command removes permission for the Microsoft.Compute resource provider to get secrets from the Contoso03Vault.

Parameters

-ApplicationId

Specifies the ID of application whose permissions should be removed

Type:System.Nullable`1[System.Guid]
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-DefaultProfile

The credentials, account, tenant, and subscription used for communication with azure

Type:Microsoft.Azure.Commands.Common.Authentication.Abstractions.IAzureContextContainer
Aliases:AzureRmContext, AzureCredential
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-EmailAddress

Specifies the user email address of the user whose access you want to remove.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-EnabledForDeployment

If specified, disables the retrieval of secrets from this key vault by the Microsoft.Compute resource provider when referenced in resource creation.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-EnabledForDiskEncryption

If specified, disables the retrieval of secrets from this key vault by Azure Disk Encryption.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-EnabledForTemplateDeployment

If specified, disables the retrieval of secrets from this key vault by Azure Resource Manager when referenced in templates.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-InputObject

Key Vault object.

Type:PSKeyVault
Position:0
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-ObjectId

Specifies the object ID of the user or service principal in Azure Active Directory for which to remove permissions.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-PassThru

Returns an object representing the item with which you are working. By default, this cmdlet does not generate any output.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ResourceGroupName

Specifies the name of the resource group associated with the key vault whose access policy is being modified. If not specified, this cmdlet searches for the key vault in the current subscription.

Type:String
Position:1
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ResourceId

KeyVault Resource Id.

Type:String
Position:0
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-ServicePrincipalName

Specifies the service principal name of the application whose permissions you want to remove. Specify the application ID, also known as client ID, registered for the application in Azure Active Directory.

Type:String
Aliases:SPN
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-UserPrincipalName

Specifies the user principal name of the user whose access you want to remove.

Type:String
Aliases:UPN
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-VaultName

Specifies the name of the key vault. This cmdlet removes permissions for the key vault that this parameter specifies.

Type:String
Position:0
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Inputs

PSKeyVault

Parameters: InputObject (ByValue)

String

Outputs

PSKeyVault