Define an environment variable on Azure environment

how to set environment variable on Azure cloud

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,

  1. DOTNET_ENVIRONMENT
  2. 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”

how to define an environment variable on azure

Click on the application for which you want to add or update the environment variable or other configuration.

where to define an environment variable on azure

  • In the App’s left menu click on Settings -> Configuration – > and Click on Application Settings

how and where to define an environment variable on azure

  • Add/Edit the Application Settings

blank

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.



Leave a Reply

Your email address will not be published. Required fields are marked *