get-azurekeyvaultkey不会返回"public key". [英] get-azurekeyvaultkey does not return "public key"
问题描述
我正在测试带有密钥/对的Azure Key Vault,并尝试检索公共密钥.
I am just testing out Azure Key Vault with key/pairs and am attempting to retrieve the public key.
我首先使用Azure门户创建了 Key Vault
(名称="VaultTest").
I first created a Key Vault
(name = "VaultTest") using Azure portal.
然后我再次使用Azure门户创建了 Key
(名称="TestKey1").
I then created a Key
(Name = "TestKey1") again using Azure portal.
我在门户中看到密钥,当我单击它时,我会看到以下信息:
I see the key in the portal and when I click on it I see the following information:
属性 :
Properties:
Key Type: RSA
RSA Key Size 2048
Created: "date time"
Updated: "date time"
Key Identifier: //vault path/keys/TestKey1/Key identifier
设置 :
Settings:
Set activation date: "unchecked"
Set expiration date: "unchecked"
Enabled: True
Tags "none"
Permitted operations:
Encrypt: true
Decrypt: true
Sign: true
Verify: true
Wrap key: true
Unwrap key: true
请注意,没有显示公钥信息,因此我切换到Azure Cloud Shell并执行了以下命令:
Notice that there is no public key information displayed so I switched over to Azure Cloud Shell and executed the following command:
Get-AzureKeyVaultKey -vaultname 'VaultTest' -name 'TestKey1'
它返回VaultName,名称,版本,ID,已启用,过期,不早于,已创建,已更新,已禁用清除和标签,但没有密钥.
It returns VaultName, Name, Version, Id, Enabled, Expires, Not Before, Created, Updated, Purge Disabled and Tags, but no Key.
我在网上阅读的所有示例(尽管有些旧)都显示了返回的 Attributes
和 Key
字段,但是这些字段对我来说却没有返回.
All the examples I read online (albeit somewhat old) show fields Attributes
and Key
being returned but those are not returning for me.
我在某处读到,如果您调用URI,它将返回公钥信息,因此我将URI复制/粘贴到浏览器中,但这返回给我:
I read somewhere that if you call the URI it will return the public key info, so I copy/pasted the URI into a browser but this returns to me:
{错误":{代码":未经授权",消息":请求缺少Bearer或PoP令牌."}}
我是在做一些脑瘫的事情,还是功能get-azurekeyvaultkey改变了?如果已更改,如何获取存储在Key Vault中的特定密钥的公共密钥信息?
Am I doing something brain dead or has the function get-azurekeyvaultkey changed? If it has changed how does one get the public key information for a specific key stored in Key Vault?
推荐答案
我可以使用 Get-AzureKeyVaultKey -vaultname'VaultTest'-name'TestKey1'
重现您的问题.
I can reproduce your issue with Get-AzureKeyVaultKey -vaultname 'VaultTest' -name 'TestKey1'
.
但是实际上它会返回所需的 Attributes
和 Key
,只需传递 |像下面这样的ConvertTo-Json
.
But actually it returns the Attributes
and Key
that you want, just pass the | ConvertTo-Json
like below.
Get-AzureKeyVaultKey -vaultname 'VaultTest' -name 'TestKey1' | ConvertTo-Json
这篇关于get-azurekeyvaultkey不会返回"public key".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!