Share via


Get-AzureRmKeyVaultKey

Get-AzureRmKeyVaultKey

Gets the keys in a vault.

Syntax

Parameter Set: ByKeyName
Get-AzureRmKeyVaultKey [-VaultName] <String> [-Name] <String> [[-Version] <String> ] [ <CommonParameters>]

Parameter Set: ByKeyVersions
Get-AzureRmKeyVaultKey [-VaultName] <String> [-Name] <String> -IncludeVersions [ <CommonParameters>]

Parameter Set: ByVaultName
Get-AzureRmKeyVaultKey [-VaultName] <String> [ <CommonParameters>]

Detailed Description

The Get-AzureRMKeyVaultKey cmdlet gets the keys in an Azure Key Vault instance. This cmdlet gets a specific Microsoft.Azure.Commands.KeyVault.Models.KeyBundle or a list of all KeyBundle objects in a vault.

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.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Name<String>

Specifies the name of the key bundle to get.

Aliases

KeyName

Required?

true

Position?

2

Default Value

none

Accept Pipeline Input?

true(ByPropertyName)

Accept Wildcard Characters?

false

-VaultName<String>

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

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true(ByPropertyName)

Accept Wildcard Characters?

false

-Version<String>

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

Aliases

KeyVersion

Required?

false

Position?

3

Default Value

none

Accept Pipeline Input?

true(ByPropertyName)

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.

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

Examples

Example 1: Get all the keys in a vault

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

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

Example 2: Get the current version of a key

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

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

Example 3: Get all versions of a key

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

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

Example 4: Get a specific version of a key

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

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

Add-AzureRmKeyVaultKey

Remove-AzureRmKeyVaultKey

Set-AzureRmKeyVaultKeyAttribute