Azure / Azure/Azure-Functions

local.settings.json not injected/included into environment variables when using a FunctionsStartup class.

Open
#2,147 2 comments 0 reactions 1 assignee Claimed by @v-bbalaiagar View on GitHub
bug
Dominant language
PowerShell
Stars
1.1k
Forks
215
Avg merge
4h 2m
Merged PRs (30d)
1

Description

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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.