Azure WebJobs environment setting

Arindam Paul Roy 16 Reputation points
2020-05-31T10:28:44.127+00:00

Hi

I have a vanilla .NET Core 3.1 app that I have hosted as a WebJob in Azure App Service.
How do I set the environment name so that it is surfaced to the webjob context when I do -
hostContext.HostingEnvironment.EnvironmentName ?

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,356 questions
0 comments No comments
{count} vote

3 answers

Sort by: Most helpful
  1. Arindam Paul Roy 16 Reputation points
    2020-06-06T08:01:50.917+00:00

    Sorry, but what is the setting name that I need to set so that it sets the WebJobs environment name?

    1 person found this answer helpful.
    0 comments No comments

  2. Grmacjon-MSFT 17,366 Reputation points
    2020-06-05T00:00:40.923+00:00

    Hi @Arindam Paul Roy ,

    I believe this can be done via the Azure portal.

    In the Azure portal, search for and select App Services, and then select your app.

    In the app's left menu, select Configuration > Application settings.

    9191-app-setting.png

    Remember setting app settings in App Service are like setting them in appSettings in Web.config or appsettings.json, but the values in App Service override the ones in Web.config or appsettings.json. You can keep development settings (for example, local MySQL password) in Web.config or appsettings.json, but production secrets (for example, Azure MySQL database password) safe in App Service. Read this doc for more info.

    Hope that helps. Please let us know if you have further questions

    Thanks,

    Grace

    0 comments No comments

  3. Jerome Pascua 1 Reputation point
    2021-07-17T04:21:08.307+00:00

    Looks like you still use ASPNETCORE_ENVIRONMENT and set it to Production, Development, or some custom environment monniker you may be using.

    https://dotnetcoretutorials.com/2018/10/10/azure-webjobs-in-net-core-part-2/

    0 comments No comments