local.settings.json not injected/included into environment variables when using a FunctionsStartup class.
Azure Function V4 - Can be easily replicated using the template solution in visual studio 2019/2022.
When you create an Azure function and you update the local.settings.json Values array with properties you want to access via Environment.GetEnvironmentVariables() they are pulled through successfully with no issues.
If you however want to use DI and you add in a FunctionsStartup class local.settings.json no longer get injected/included within the Environment Variables.
Now I realize that you can work around this by implementing IConfiguration. However the Microsoft Documentation states that the benefit of using GetEnvironmentVariables is that if we set up access to a Key Vault, the relevant keys can be pulled from that using GetEnvironmentVariables, so we don't have to necessarily write code to do this. It's nice and neat.
So I am unsure if this is a bug, or if it is acting as intended. The behavior seems to run counter to the official documentation.
After doing a bit of investigating; my working theory is that creating a startup function overrides some of the boilerplate start-up logic for an Azure function.
I think that's likely intended in hindsight; but this could definately do with an update to the documentation for the FunctionStartup implementation.
Hi @JoeTomkinson , Thank you for the feedback!
Tagging @ggailey777, Since its a document related issue. Can we add this in our documents and if its a valid note, then can we transfer this issue to the docs repo.