Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is the intention of AZURE_FUNCTIONS_ENVIRONMENT variable? #4491

Closed
sandeepiiit opened this issue May 24, 2019 · 1 comment
Closed

What is the intention of AZURE_FUNCTIONS_ENVIRONMENT variable? #4491

sandeepiiit opened this issue May 24, 2019 · 1 comment
Labels

Comments

@sandeepiiit
Copy link

sandeepiiit commented May 24, 2019

Is your question related to a specific version? If so, please specify:

Function runtime v2

What language does your question apply to? (e.g. C#, JavaScript, Java, All)

C#

Question

When running a C# function in Visual Studio, I notice that an environment variable called "AZURE_FUNCTIONS_ENVIRONMENT" is set to Development? How is this variable used? Is AZURE_FUNCTIONS_ENVIRONMENT to functions what ASPNETCORE_ENVIRONMENT is for asp dotnet core web apps?
I am planning to use on those two variables to load an environment specific settings file: appsettings.{environmentname}.json, and I am wondering which one is the right approach?

@kashimiz
Copy link
Contributor

kashimiz commented Jun 11, 2019

You'll want to use AZURE_FUNCTIONS_ENVIRONMENT. The Functions runtime that powers a Function app on Azure is the WebHost project in this repo. As the host is initializing, it looks for the AZURE_FUNCTIONS_ENVIRONMENT app setting (as EnvironmentSettingNames.EnvironmentNameKey) and passes it to the IWebHostBuilder. Using only ASPNETCORE_ENVIRONMENT can lead to desired behavior changes and telemetry being missed.

@Azure Azure locked as resolved and limited conversation to collaborators Dec 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants