Get-AzKeyVaultKey
Gets Key Vault keys. Please notes that detailed information about a key, like key type or key size, only available when querying a specific key version.
语法
ByVaultName (默认值)
Get-AzKeyVaultKey
[-VaultName] <String>
[[-Name] <String>]
[-InRemovedState]
[-OutFile <String>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
ByKeyName
Get-AzKeyVaultKey
[-VaultName] <String>
[-Name] <String>
[-Version] <String>
[-OutFile <String>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
ByKeyVersions
Get-AzKeyVaultKey
[-VaultName] <String>
[-Name] <String>
[-IncludeVersions]
[-OutFile <String>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
HsmByKeyName
Get-AzKeyVaultKey
[-Name] <String>
[-Version] <String>
-HsmName <String>
[-OutFile <String>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
HsmByVaultName
Get-AzKeyVaultKey
[[-Name] <String>]
-HsmName <String>
[-InRemovedState]
[-OutFile <String>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
HsmByKeyVersions
Get-AzKeyVaultKey
[-Name] <String>
-HsmName <String>
[-IncludeVersions]
[-OutFile <String>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Get-AzKeyVaultKey
[-InputObject] <PSKeyVault>
[[-Name] <String>]
[-InRemovedState]
[-OutFile <String>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Get-AzKeyVaultKey
[-InputObject] <PSKeyVault>
[-Name] <String>
[-Version] <String>
[-OutFile <String>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Get-AzKeyVaultKey
[-InputObject] <PSKeyVault>
[-Name] <String>
[-IncludeVersions]
[-OutFile <String>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Get-AzKeyVaultKey
[-HsmObject] <PSManagedHsm>
[[-Name] <String>]
[-InRemovedState]
[-OutFile <String>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Get-AzKeyVaultKey
[-HsmObject] <PSManagedHsm>
[-Name] <String>
[-Version] <String>
[-OutFile <String>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Get-AzKeyVaultKey
[-HsmObject] <PSManagedHsm>
[-Name] <String>
[-IncludeVersions]
[-OutFile <String>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
ByResourceIdVaultName
Get-AzKeyVaultKey
[[-Name] <String>]
-ResourceId <String>
[-InRemovedState]
[-OutFile <String>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
ByResourceIdKeyName
Get-AzKeyVaultKey
[-Name] <String>
[-Version] <String>
-ResourceId <String>
[-OutFile <String>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
ByResourceIdKeyVersions
Get-AzKeyVaultKey
[-Name] <String>
-ResourceId <String>
[-IncludeVersions]
[-OutFile <String>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
HsmByResourceIdVaultName
Get-AzKeyVaultKey
[[-Name] <String>]
-HsmResourceId <String>
[-InRemovedState]
[-OutFile <String>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
HsmByResourceIdKeyName
Get-AzKeyVaultKey
[-Name] <String>
[-Version] <String>
-HsmResourceId <String>
[-OutFile <String>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
HsmByResourceIdKeyVersions
Get-AzKeyVaultKey
[-Name] <String>
-HsmResourceId <String>
[-IncludeVersions]
[-OutFile <String>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
说明
The Get-AzKeyVaultKey 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.
示例
Example 1: Get all the keys in a key vault
Get-AzKeyVaultKey -VaultName 'contoso'
Vault/HSM Name : contoso
Name : test1
Version :
Id : https://contoso.vault.azure.net:443/keys/test1
Enabled : True
Expires : 11/24/2018 6:08:13 PM
Not Before : 5/24/2018 5:58:13 PM
Created : 5/24/2018 6:08:13 PM
Updated : 5/24/2018 6:08:13 PM
Purge Disabled : False
Tags :
Vault Name : contoso
Name : test2
Version :
Id : https://contoso.vault.azure.net:443/keys/test2
Enabled : True
Expires : 11/24/2018 6:09:44 PM
Not Before : 5/24/2018 5:59:44 PM
Created : 5/24/2018 6:09:44 PM
Updated : 5/24/2018 6:09:44 PM
Purge Disabled : False
Tags :
This command gets all the keys in the key vault named Contoso.
Example 2: Get the current version of a key
Get-AzKeyVaultKey -VaultName 'contoso' -KeyName 'test1'
Vault/HSM Name : contoso
Name : test1
Key Type : RSA
Key Size : 2048
Version : 7fe415d5518240c1a6fce89986b8d334
Id : https://contoso.vault.azure.net:443/keys/test1/7fe415d5518240c1a6fce89986b8d334
Enabled : True
Expires : 11/24/2018 6:08:13 PM
Not Before : 5/24/2018 5:58:13 PM
Created : 5/24/2018 6:08:13 PM
Updated : 5/24/2018 6:08:13 PM
Purge Disabled : False
Tags :
This command gets the current version of the key named test1 in the key vault named Contoso.
Example 3: Get all versions of a key
Get-AzKeyVaultKey -VaultName 'contoso' -KeyName 'test1' -IncludeVersions
Vault/HSM Name : contoso
Name : test1
Version : 7fe415d5518240c1a6fce89986b8d334
Id : https://contoso.vault.azure.net:443/keys/test1/7fe415d5518240c1a6fce89986b8d334
Enabled : True
Expires : 11/24/2018 6:08:13 PM
Not Before : 5/24/2018 5:58:13 PM
Created : 5/24/2018 6:08:13 PM
Updated : 5/24/2018 6:08:13 PM
Purge Disabled : False
Tags :
Vault/HSM Name : contoso
Name : test1
Version : e4e95940e669407fbdb4298bc21a3e1d
Id : https://contoso.vault.azure.net:443/keys/test1/e4e95940e669407fbdb4298bc21a3e1d
Enabled : False
Expires : 11/24/2018 6:08:08 PM
Not Before : 5/24/2018 5:58:08 PM
Created : 5/24/2018 6:08:08 PM
Updated : 5/24/2018 6:08:08 PM
Purge Disabled : False
Tags :
This command gets all versions the key named ITPfx in the key vault named Contoso.
Example 4: Get a specific version of a key
Get-AzKeyVaultKey -VaultName 'contoso' -KeyName 'test1' -Version 'e4e95940e669407fbdb4298bc21a3e1d'
Vault/HSM Name : contoso
Name : test1
Key Type : RSA
Key Size : 2048
Version : e4e95940e669407fbdb4298bc21a3e1d
Id : https://contoso.vault.azure.net:443/keys/test1/e4e95940e669407fbdb4298bc21a3e1d
Enabled : False
Expires : 11/24/2018 6:08:08 PM
Not Before : 5/24/2018 5:58:08 PM
Created : 5/24/2018 6:08:08 PM
Updated : 5/24/2018 6:08:08 PM
Purge Disabled : False
Tags :
This command gets a specific version of the key named test1 in the key vault named Contoso.
After running this command, you can inspect various properties of the key by navigating the $Key object.
Example 5: Get all the keys that have been deleted but not purged for this key vault
Get-AzKeyVaultKey -VaultName 'contoso' -InRemovedState
Vault/HSM Name : contoso
Name : test3
Id : https://contoso.vault.azure.net:443/keys/test3
Deleted Date : 5/24/2018 8:32:42 PM
Scheduled Purge Date : 8/22/2018 8:32:42 PM
Enabled : True
Expires :
Not Before :
Created : 5/24/2018 8:32:27 PM
Updated : 5/24/2018 8:32:27 PM
Purge Disabled : False
Tags :
This command gets all the keys that have been previously deleted, but not purged, in the key vault named Contoso.
Example 6: Gets the key ITPfx that has been deleted but not purged for this key vault.
Get-AzKeyVaultKey -VaultName 'contoso' -KeyName 'test3' -InRemovedState
Vault/HSM Name : contoso
Name : test3
Id : https://contoso.vault.azure.net:443/keys/test3/1af807cc331a49d0b52b7c75e1b2366e
Deleted Date : 5/24/2018 8:32:42 PM
Scheduled Purge Date : 8/22/2018 8:32:42 PM
Enabled : True
Expires :
Not Before :
Created : 5/24/2018 8:32:27 PM
Updated : 5/24/2018 8:32:27 PM
Purge Disabled : False
Tags :
This command gets the key test3 that has been previously deleted, but not purged, in the key vault named Contoso.
This command will return metadata such as the deletion date, and the scheduled purging date of this deleted key.
Example 7: Get all the keys in a key vault using filtering
Get-AzKeyVaultKey -VaultName 'contoso' -KeyName "test*"
Vault/HSM Name : contoso
Name : test1
Version :
Id : https://contoso.vault.azure.net:443/keys/test1
Enabled : True
Expires : 11/24/2018 6:08:13 PM
Not Before : 5/24/2018 5:58:13 PM
Created : 5/24/2018 6:08:13 PM
Updated : 5/24/2018 6:08:13 PM
Purge Disabled : False
Tags :
Vault/HSM Name : contoso
Name : test2
Version :
Id : https://contoso.vault.azure.net:443/keys/test2
Enabled : True
Expires : 11/24/2018 6:09:44 PM
Not Before : 5/24/2018 5:59:44 PM
Created : 5/24/2018 6:09:44 PM
Updated : 5/24/2018 6:09:44 PM
Purge Disabled : False
Tags :
This command gets all the keys in the key vault named Contoso that start with "test".
Example 8: Download a public key as a .pem file
参数
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with azure
参数属性
参数集
(All)
Position: Named
必需: False
来自管道的值: False
来自管道的值(按属性名称): False
来自剩余参数的值: False
-HsmName
HSM name. Cmdlet constructs the FQDN of a managed HSM based on the name and currently selected environment.
参数属性
类型: String
默认值: None
支持通配符: False
不显示: False
参数集
HsmByKeyName
Position: Named
必需: True
来自管道的值: False
来自管道的值(按属性名称): False
来自剩余参数的值: False
HsmByVaultName
Position: Named
必需: True
来自管道的值: False
来自管道的值(按属性名称): False
来自剩余参数的值: False
HsmByKeyVersions
Position: Named
必需: True
来自管道的值: False
来自管道的值(按属性名称): False
来自剩余参数的值: False
-HsmObject
HSM object.
参数属性
参数集
HsmByInputObjectVaultName
Position: 0
必需: True
来自管道的值: True
来自管道的值(按属性名称): False
来自剩余参数的值: False
HsmByInputObjectKeyName
Position: 0
必需: True
来自管道的值: True
来自管道的值(按属性名称): False
来自剩余参数的值: False
HsmByInputObjectKeyVersions
Position: 0
必需: True
来自管道的值: True
来自管道的值(按属性名称): False
来自剩余参数的值: False
-HsmResourceId
HSM Resource Id.
参数属性
类型: String
默认值: None
支持通配符: False
不显示: False
参数集
HsmByResourceIdVaultName
Position: Named
必需: True
来自管道的值: False
来自管道的值(按属性名称): True
来自剩余参数的值: False
HsmByResourceIdKeyName
Position: Named
必需: True
来自管道的值: False
来自管道的值(按属性名称): True
来自剩余参数的值: False
HsmByResourceIdKeyVersions
Position: Named
必需: True
来自管道的值: False
来自管道的值(按属性名称): True
来自剩余参数的值: False
-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 .
参数属性
参数集
ByKeyVersions
Position: Named
必需: True
来自管道的值: False
来自管道的值(按属性名称): False
来自剩余参数的值: False
HsmByKeyVersions
Position: Named
必需: True
来自管道的值: False
来自管道的值(按属性名称): False
来自剩余参数的值: False
ByInputObjectKeyVersions
Position: Named
必需: True
来自管道的值: False
来自管道的值(按属性名称): False
来自剩余参数的值: False
HsmByInputObjectKeyVersions
Position: Named
必需: True
来自管道的值: False
来自管道的值(按属性名称): False
来自剩余参数的值: False
ByResourceIdKeyVersions
Position: Named
必需: True
来自管道的值: False
来自管道的值(按属性名称): False
来自剩余参数的值: False
HsmByResourceIdKeyVersions
Position: Named
必需: True
来自管道的值: False
来自管道的值(按属性名称): False
来自剩余参数的值: False
KeyVault object.
ByInputObjectVaultName
Position: 0
必需: True
来自管道的值: True
来自管道的值(按属性名称): False
来自剩余参数的值: False
ByInputObjectKeyName
Position: 0
必需: True
来自管道的值: True
来自管道的值(按属性名称): False
来自剩余参数的值: False
ByInputObjectKeyVersions
Position: 0
必需: True
来自管道的值: True
来自管道的值(按属性名称): False
来自剩余参数的值: False
-InRemovedState
Specifies whether to show the previously deleted keys in the output
参数属性
参数集
ByVaultName
Position: Named
必需: False
来自管道的值: False
来自管道的值(按属性名称): False
来自剩余参数的值: False
HsmByVaultName
Position: Named
必需: False
来自管道的值: False
来自管道的值(按属性名称): False
来自剩余参数的值: False
ByInputObjectVaultName
Position: Named
必需: False
来自管道的值: False
来自管道的值(按属性名称): False
来自剩余参数的值: False
HsmByInputObjectVaultName
Position: Named
必需: False
来自管道的值: False
来自管道的值(按属性名称): False
来自剩余参数的值: False
ByResourceIdVaultName
Position: Named
必需: False
来自管道的值: False
来自管道的值(按属性名称): False
来自剩余参数的值: False
HsmByResourceIdVaultName
Position: Named
必需: False
来自管道的值: False
来自管道的值(按属性名称): False
来自剩余参数的值: False
-Name
Specifies the name of the key bundle to get.
参数属性
类型: String
默认值: None
支持通配符: True
不显示: False
别名: KeyName
参数集
ByVaultName
Position: 1
必需: False
来自管道的值: False
来自管道的值(按属性名称): False
来自剩余参数的值: False
HsmByVaultName
Position: 1
必需: False
来自管道的值: False
来自管道的值(按属性名称): False
来自剩余参数的值: False
ByInputObjectVaultName
Position: 1
必需: False
来自管道的值: False
来自管道的值(按属性名称): False
来自剩余参数的值: False
HsmByInputObjectVaultName
Position: 1
必需: False
来自管道的值: False
来自管道的值(按属性名称): False
来自剩余参数的值: False
ByResourceIdVaultName
Position: 1
必需: False
来自管道的值: False
来自管道的值(按属性名称): False
来自剩余参数的值: False
HsmByResourceIdVaultName
Position: 1
必需: False
来自管道的值: False
来自管道的值(按属性名称): False
来自剩余参数的值: False
-OutFile
Specifies the output file for which this cmdlet saves the key. The public key is saved in PEM format by default.
参数属性
类型: String
默认值: None
支持通配符: False
不显示: False
参数集
(All)
Position: Named
必需: False
来自管道的值: False
来自管道的值(按属性名称): False
来自剩余参数的值: False
-ResourceId
KeyVault Resource Id.
参数属性
类型: String
默认值: None
支持通配符: False
不显示: False
参数集
ByResourceIdVaultName
Position: Named
必需: True
来自管道的值: False
来自管道的值(按属性名称): True
来自剩余参数的值: False
ByResourceIdKeyName
Position: Named
必需: True
来自管道的值: False
来自管道的值(按属性名称): True
来自剩余参数的值: False
ByResourceIdKeyVersions
Position: Named
必需: True
来自管道的值: False
来自管道的值(按属性名称): True
来自剩余参数的值: 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.
参数属性
类型: String
默认值: None
支持通配符: False
不显示: False
参数集
ByVaultName
Position: 0
必需: True
来自管道的值: False
来自管道的值(按属性名称): False
来自剩余参数的值: False
ByKeyName
Position: 0
必需: True
来自管道的值: False
来自管道的值(按属性名称): False
来自剩余参数的值: False
ByKeyVersions
Position: 0
必需: True
来自管道的值: False
来自管道的值(按属性名称): False
来自剩余参数的值: False
-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.
参数属性
类型: String
默认值: None
支持通配符: False
不显示: False
别名: KeyVersion
参数集
ByKeyName
Position: 2
必需: True
来自管道的值: False
来自管道的值(按属性名称): False
来自剩余参数的值: False
HsmByKeyName
Position: 2
必需: True
来自管道的值: False
来自管道的值(按属性名称): False
来自剩余参数的值: False
ByInputObjectKeyName
Position: 2
必需: True
来自管道的值: False
来自管道的值(按属性名称): False
来自剩余参数的值: False
HsmByInputObjectKeyName
Position: 2
必需: True
来自管道的值: False
来自管道的值(按属性名称): False
来自剩余参数的值: False
ByResourceIdKeyName
Position: 2
必需: True
来自管道的值: False
来自管道的值(按属性名称): False
来自剩余参数的值: False
HsmByResourceIdKeyName
Position: 2
必需: True
来自管道的值: False
来自管道的值(按属性名称): False
来自剩余参数的值: 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 .
输出