gpt4 book ai didi

azure - 将 key 设置为子级别的 Azure Key Vault

转载 作者:行者123 更新时间:2023-12-02 05:51:50 26 4
gpt4 key购买 nike

对于用户 secret 管理,我在开发阶段使用用户 secret ,并希望使用 Azure key 保管库进行发布和暂存。我有这个配置

"ConnectionStrings": {
"DefaultConnection": "MySecretConnectionString"
},
"SmtpSettings": {
"SmtpMailServer": "smtp.mailserver.somewhere",
"SmtpPort": "465",
"SenderLogin": "login",
"SenderDisplayName": "Site ",
"SenderPassword": "password",
"SenderEmail": "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d2a1bba6b792bfb3bbbea1b7a0a4b7a0fca1bdbfb7a5bab7a0b7" rel="noreferrer noopener nofollow">[email protected]</a>",
"SecureSocketSettings": "SslOnConnect"
}

当我想在 Azure key 保管库中设置 ConnectionStrings:DefaultConnectionSmtpSettings:SenderPassword 时,会出现问题。

有什么方法可以为嵌套属性分配和使用值吗?例如,就像我对用户 secret 所做的那样

dotnet user-secrets set "SmtpSettings:SenderPassword" "########" --project MyProject

但是对于 Azure key 保管库

az keyvault secret set --name "SmtpSettings:SenderPassword" --value "######" --vault-name MyProjectVault

:不允许,参数“secret_name”必须符合以下模式:“^[0-9a-zA-Z-]+$”。

最佳答案

您应该使用 --,如 documentation 中所述。

Azure Key Vault secret names are limited to alphanumeric charactersand dashes. Hierarchical values (configuration sections) use -- (twodashes) as a delimiter, as colons aren't allowed in key vault secretnames. Colons delimit a section from a subkey in ASP.NET Coreconfiguration. The two-dash sequence is replaced with a colon when thesecrets are loaded into the app's configuration.

az keyvault secret set --name "SmtpSettings--SenderPassword" --value "######" --vault-name MyProjectVault

关于azure - 将 key 设置为子级别的 Azure Key Vault,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67561726/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com