When running the Azure Function locally, I would like the environment to be set to ‘local’ instead of Development. How would I make that change?
Microsoft info: https://learn.microsoft.com/en-us/azure/azure-functions/functions-app-settings
When you create an Azure Function project, there is a JSON file called local.settings.json
that comes with the template. The JSON file has a property called Values
. Anything you add to it, will become an environment variable, so you can set AZURE_FUNCTIONS_ENVIRONMENT
to “local” there.
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated",
"AZURE_FUNCTIONS_ENVIRONMENT": "local"
}
}