Programmatically set Azure App Service application settings / environment variables

血红的双手。 提交于 2019-12-24 00:45:43

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/36368786/programmatically-set-azure-app-service-application-settings-environment-variab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!