Azure DevOps使用Azure Key Vault进行JSON替换部署 [英] Azure DevOps use Azure Key Vault for Deploy JSON variable substitution

查看:124
本文介绍了Azure DevOps使用Azure Key Vault进行JSON替换部署的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于部署,我使用Azure DevOps中的任务Azure App Service部署.为了保存变量,我使用了变量组Azure DevOPs,并使用了JSON变量替换,我覆盖了appsettings.json中的值.例如appsettings.json

For deployment I use the task Azure App Service deploy in Azure DevOps. For save my variables I use variables group Azure DevOPs and use JSON variable substitution I overwrite the values in appsettings.json. For example section in appsettings.json

    "ConnectionStrings": {
        "DefaultConnection": "Azure DB Connection String"
        }
   }

在变量组中,我使用ConnectionStrings.DefaultConnection "Azure DB Connection String"

现在,我想将Key Vault用于这些目的.但是,当我在Key Vault中创建变量并将其连接到Azure DevOps时,该值未写入appsettings.json.

Now I want to use Key Vault for these purposes. But when I created the variables in Key vault and connected it to Azure DevOps the value did not write to appsettings.json.

能否请您告诉我如何在Azure DevOps部署中使用Azure Key Vault?我有一个邮编制品.谢谢.

Could you please tell me how can I use Azure Key Vault in Azure DevOps deployment? I have a zip artifact. Thanks.

推荐答案

完全没有理由对运行在Azure应用服务中的应用进行配置转换 .

There is no reason to be doing a configuration transformation at all for an application running in an Azure app service.

您将值保存在密钥库中.您有一个Azure应用服务.应用服务可以直接从密钥库中检索值(方法因语言而异,但是.NET应用有NuGet包),或者您可以使用应用服务应用设置部分并在

You have the values in a key vault. You have an Azure App Service. App services can retrieve values directly from the key vault (the method varies from language to language, but there's a NuGet package for .NET applications), or you can use the app service app settings section and put keyvault references in.

即使您没有使用密钥库,也无需进行配置转换. Web应用程序应用程序设置存储为环境变量,并且可以通过您选择的语言用来读取环境变量的任何机制在运行时检索.

Even if you weren't using a key vault, there's no need for configuration transforms. Web app app settings are stored as environment variables and can be retrieved at runtime by whatever mechanism your language of choice uses to read environment variables.

这篇关于Azure DevOps使用Azure Key Vault进行JSON替换部署的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆