以编程方式设置Azure App Service应用程序设置/环境变量 [英] Programmatically set Azure App Service application settings / environment variables
问题描述
我想通过编程方式设置这些环境变量,以便我不必经历Azure Portal每次我想要创建一个新的环境变量或修改现有的环境变量。理想情况下,我想通过调用REST API来执行此操作。这是可能的,如果是,如何?
而不是在Azure Portal中设置环境变量,您可以部署一个appsettings .json文件与您的应用程序一起使用所需的设置。如果您有构建服务器或部署服务器,则可以使用正确的环境设置来转换配置文件。
如果您正在使用八达通部署进行部署,可以使用JSON配置变量功能来处理这个问题。
http://docs.octopusdeploy.com/display/OD/JSON+Configuration+Variables+Feature
I have an ASP.NET Core (RC1) app running on Azure App Service. The app takes its configuration from environment variables. I currently use the Azure Portal's 'Application Settings' page to set these environment variables. The app is deployed with Kudu (if this is relevant?)
I would like a way to programmatically set these environment variables so that I don't have to go through the Azure Portal every time I want to create a new environment variable or modify an existing environment variable. Ideally I would like to do this by calling a REST API. Is this possible, and if so, how?
Instead of setting environment variables in the Azure Portal, you could deploy an appsettings.json file along with your app with the desired settings. If you have a build server or deployment server, you could transform the config file with the correct settings for your environment.
If you i.e. are using Octopus Deploy for deployments, you could use the JSON Configuration variables feature to handle this.
http://docs.octopusdeploy.com/display/OD/JSON+Configuration+Variables+Feature
这篇关于以编程方式设置Azure App Service应用程序设置/环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!