Define an environment variable on Azure environment
In this article, we shall learn How to Define an environment variable on Azure Cloud and configure common settings for web apps, mobile back end, or API apps using the Azure portal.
Today in this article, we will cover below aspects,
To set environment variables in the Azure portal is simple. Kindly follow below basic steps.
Default Runtime Environment
ASP.NET Core reads from the following environment variables when determining runtime environment,
- DOTNET_ENVIRONMENT
- ASPNETCORE_ENVIRONMENT
You can very much define any other variable as needed using similar steps
So you need to set the above environment variable in azure.
You can also use any custom variable to denote the environment. Please refer this article for more details.
We will use one of the above environment variables to be configured in Azure.
- Go to the Azure Portal -> Search for “AppServices”
Click on the application for which you want to add or update the environment variable or other configuration.
- In the App’s left menu click on Settings -> Configuration – > and Click on Application Settings
- Add/Edit the Application Settings
And Save your settings.
For ASP.NET and ASP.NET Core, app settings in App Service will override the settings in Web.config or appsettings.json.
References:
Do you have any comments or ideas or any better suggestions to share?
Please sound off your comments below.
Happy Coding !!
Please bookmark this page and share it with your friends. Please Subscribe to the blog to receive notifications on freshly published(2024) best practices and guidelines for software design and development.