Share via


Remove-AzureRmKeyVaultKey

Remove-AzureRmKeyVaultKey

Deletes a key in a vault.

Syntax

Parameter Set: Default
Remove-AzureRmKeyVaultKey [-VaultName] <String> [-Name] <String> [-Force] [-PassThru] [-Confirm] [-WhatIf] [ <CommonParameters>]

Detailed Description

The Remove-AzureKeyVaultKey cmdlet deletes a key in an Azure Key Vault instance. This cmdlet has a value of high for the ConfirmImpact property.

Parameters

-Force

Forces the command to run without asking for user confirmation.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Name<String>

Specifies the name of the key to remove. This cmdlet constructs the fully qualified domain name (FQDN) of a key based on the name that this parameter specifies, the name of the vault, and your current environment.

Aliases

KeyName

Required?

true

Position?

2

Default Value

none

Accept Pipeline Input?

true(ByPropertyName)

Accept Wildcard Characters?

false

-PassThru

Indicates that this cmdlet returns a Microsoft.Azure.Commands.KeyVault.Models.KeyBundle object. By default, this cmdlet does not generate any output.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-VaultName<String>

Specifies the name of the vault from which to remove the key. This cmdlet constructs the FQDN of a vault based on the name that this parameter specifies and your current environment.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true(ByPropertyName)

Accept Wildcard Characters?

false

-Confirm

Prompts you for confirmation before running the cmdlet.

Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-WhatIf

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

Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see    about_CommonParameters.

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

Outputs

The output type is the type of the objects that the cmdlet emits.

  • Microsoft.Azure.Commands.KeyVault.Models.KeyBundle

    This cmdlet returns a value only if you specify the PassThru parameter.

Examples

Example 1: Remove a key from a vault

This command removes the key named ITSoftware from the vault named Contoso.

PS C:\> Remove-AzureKeyVaultKey -VaultName 'Contoso' -Name 'ITSoftware'

Example 2: Remove a key without user confirmation

This command removes the key named ITSoftware from the vault named Contoso. The command specifies the Force and Confirm parameters, and, therefore, the cmdlet does not prompt you for confirmation.

PS C:\> Remove-AzureKeyVaultKey -VaultName 'Contoso' -Name 'ITSoftware' -Force -Confirm:$False

Example 3: Remove keys by using the pipeline operator

This command gets all the keys in the vault named Contoso, and passes them to the Where-Object cmdlet by using the pipeline operator. That cmdlet passes the keys that have a value of $False for the Enabled attribute to the current cmdlet. That cmdlet removes those keys.

PS C:\> Get-AzureKeyVaultKey -VaultName 'Contoso' | Where-Object {$_.Attributes.Enabled -eq $False} | Remove-AzureKeyVaultKey

Add-AzureRmKeyVaultKey

Get-AzureRmKeyVaultKey

Set-AzureRmKeyVaultKeyAttribute