-
Notifications
You must be signed in to change notification settings - Fork 457
Description
Core Tools version: 3.0.3233
Function Runtime Version: 3.0.15193.0
Repro steps
- Fetch function app configuration from Azure function in azure portal which has AZURE_FUNCTIONS_ENVIRONMENT set
- Start Azure function locally via Rider run
Expected behavior
Azure function should start up normally and read the AZURE_FUNCTIONS_ENVIRONMENT variable from previously fetched local.settings.json
Actual behavior
Function does not start locally, as the fails to add the AZURE_FUNCTIONS_ENVIRONMENT variable again.
"An item with the same key has already been added. Key: AZURE_FUNCTIONS_ENVIRONMENT"
Known workarounds
Workarund is to remove the AZURE_FUNCTIONS_ENVIRONMENT variable from local.settings.json after fetching the settings from the portal to continue developing it locally.
Related information
Using Rider 2020.3.2 and developing in C#/dotnet
AZURE_FUNCTIONS_ENVIRONMENT should work as any other env variable in my opinion. When it's set in a system/user level, it should get it from there, if not, grab it from local.settings.json. Or at least, it should not stop the function from starting.
I am wondering that this problem isn't more common, as I suspect everyone has set AZURE_FUNCTIONS_ENVIRONMENT in his azure function appsettings in Azure(?) and at least a few use the fetch app settings method to generate local.settings.json to work locally
Maybe I am doing something wrong, please let me know