Get-​Azure​Key​Vault​Key

Gets Key Vault keys.

Syntax

Get-AzureKeyVaultKey
   [-VaultName] <String>
   [-Name] <String>
   [-IncludeVersions]
   [<CommonParameters>]
Get-AzureKeyVaultKey
   [-VaultName] <String>
   [-Name] <String>
   [[-Version] <String>]
   [<CommonParameters>]

Description

The Get-AzureKeyVaultKey cmdlet gets Azure Key Vault keys. This cmdlet gets a specific Microsoft.Azure.Commands.KeyVault.Models.KeyBundle or a list of all KeyBundle objects in a key vault or by version.

Examples

Example 1: Get all the keys in a key vault

PS C:\>Get-AzureKeyVaultKey -VaultName 'Contoso'

This command gets all the keys in the key vault named Contoso.

Example 2: Get the current version of a key

PS C:\>Get-AzureKeyVaultKey -VaultName 'Contoso' -KeyName 'ITPfx'

This command gets the current version of the key named ITPfx in the key vault named Contoso.

Example 3: Get all versions of a key

PS C:\>Get-AzureKeyVaultKey -VaultName 'Contoso' -KeyName 'ITPfx' -IncludeVersions

This command gets all versions the key named ITPfx in the key vaultnamed Contoso.

Example 4: Get a specific version of a key

PS C:\>$Key = Get-AzureKeyVaultKey -VaultName 'Contoso' -KeyName 'ITPfx' -Version '5A12A276385949DB8B5F82AFEE85CAED'

This command gets a specific version of the key named ITPfx in the key vault named Contoso. After running this command, you can inspect various properties of the key by navigating the $Key object.

Required Parameters

-IncludeVersions

Indicates that this cmdlet gets all versions of a key. The current version of a key is the first one on the list. If you specify this parameter you must also specify the Name and VaultName parameters.If you do not specify the IncludeVersions parameter, this cmdlet gets the current version of the key with the specified Name.

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

Specifies the name of the key bundle to get.

Type:String
Aliases:KeyName
Position:2
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-VaultName

Specifies the name of the key vault from which this cmdlet gets keys. This cmdlet constructs the fully qualified domain name (FQDN) of a key vault based on the name that this parameter specifies and your selected environment.

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

Optional Parameters

-Version

Specifies the key version. This cmdlet constructs the FQDN of a key based on the key vault name, your currently selected environment, the key name, and the key version.

Type:String
Aliases:KeyVersion
Position:3
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False

Inputs

String

Outputs

List<Microsoft.Azure.Commands.KeyVault.Models.KeyBundle>, Microsoft.Azure.Commands.KeyVault.Models.KeyBundle