get-azurekeyvaultkey 不 return "public key"

get-azurekeyvaultkey does not return "public key"

我正在使用 key/pairs 测试 Azure Key Vault 并尝试检索 public 密钥。

我首先使用 Azure 门户创建了一个 Key Vault(名称 = "VaultTest")。

然后我再次使用 Azure 门户创建了一个 Key(名称 = "TestKey1")。

我在门户中看到密钥,当我点击它时,我看到以下信息:

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

注意没有显示 public 关键信息,所以我切换到 Azure Cloud Shell 并执行以下命令:

Get-AzureKeyVaultKey -vaultname 'VaultTest' -name 'TestKey1'

它 returns VaultName、名称、版本、Id、启用、过期、不早于、创建、更新、清除禁用和标签,但没有密钥。

我在网上阅读的所有示例(尽管有点旧)显示字段 AttributesKey 正在 returned,但这些不适合我 returning。

我在某处读到,如果你调用 URI,它将 return public 关键信息,所以我 copy/pasted 将 URI 放入浏览器,但是这个 returns对我来说:

{"error":{"code":"Unauthorized","message":"Request is missing a Bearer or PoP token."}}

我是不是脑残了,还是函数 get-azurekeyvaultkey 变了?如果它已更改,如何获取存储在 Key Vault 中的特定密钥的 public 密钥信息?

我可以用 Get-AzureKeyVaultKey -vaultname 'VaultTest' -name 'TestKey1' 重现您的问题。

但实际上它 returns 你想要的 AttributesKey,只需像下面那样传递 | ConvertTo-Json

Get-AzureKeyVaultKey -vaultname 'VaultTest' -name 'TestKey1' | ConvertTo-Json