【问题标题】:View contents of Secret in Azure KeyVault在 Azure KeyVault 中查看 Secret 的内容
【发布时间】:2016-01-20 17:02:56
【问题描述】:

这似乎是一个非常基本的问题,但我已经在 Azure 中创建了一个 KeyVault 并向其中添加了两个 Secret,它们是使用 ConvertTo-SecureString 保护的纯文本“hello world”示例。

使用 Get-AzureKeyVaultSecret 我可以看到两个条目都在那里,并且还看到了每个条目的唯一 URI,但是我似乎无法找到任何方法来实际检索我所拥有的“hello world”文本添加到每个秘密中。

任何人都可以提供缺少的链接,因为 Microsoft 网站上的当前文档目前并不太广泛。

【问题讨论】:

    标签: azure azure-keyvault


    【解决方案1】:

    这样的事情应该这样做......

    $key = Add-AzureKeyVaultKey -VaultName DeploymentVault `
                                -Name test1 -Destination Software
    
    $securepwd = ConvertTo-SecureString –String '123' –AsPlainText –Force
    
    $secrets = Set-AzureKeyVaultSecret -VaultName DeploymentVault `
                                       -Name test1 `
                                       -SecretValue $securepwd
    
    $secret = Get-AzureKeyVaultSecret -VaultName DeploymentVault -Name test1
    
    $secret.SecretValueText
    

    返回123

    【讨论】:

    • 谢谢迈克尔 - 我怀疑这可能是我刚刚错过的简单得惊人的事情:)
    • @AndyHerb 我们都去过那里! - 您也可以使用$secret.SecretValue 获取 SecureString 版本
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-02-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-07-15
    • 2021-12-19
    相关资源
    最近更新 更多