对于用户机密管理,我在开发阶段使用用户机密,并希望使用 Azure 密钥保管库进行发布和暂存。我有这个配置
"ConnectionStrings": {
"DefaultConnection": "MySecretConnectionString"
},
"SmtpSettings": {
"SmtpMailServer": "smtp.mailserver.somewhere",
"SmtpPort": "465",
"SenderLogin": "login",
"SenderDisplayName": "Site ",
"SenderPassword": "password",
"SenderEmail": "site@mailserver.somewhere",
"SecureSocketSettings": "SslOnConnect"
}
Run Code Online (Sandbox Code Playgroud)
当我想要在 Azure 密钥保管库中设置ConnectionStrings:DefaultConnection或存储时,就会出现问题。SmtpSettings:SenderPassword
有什么方法可以为嵌套属性分配和使用值吗?例如,就像我对用户机密所做的那样
dotnet user-secrets set "SmtpSettings:SenderPassword" "########" --project MyProject
Run Code Online (Sandbox Code Playgroud)
但对于 Azure 密钥保管库
az keyvault secret set --name "SmtpSettings:SenderPassword" --value "######" --vault-name MyProjectVault
Run Code Online (Sandbox Code Playgroud)
: 不允许,Parameter 'secret_name' must conform to the following pattern: '^[0-9a-zA-Z-]+$'.
connection-string appsettings azure azure-keyvault asp.net-core