Azure / Azure/azure-functions-dotnet-worker

Inconsistency managing local.settings.json and secrets between host and worker

Open
#2,230 2 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
C#
Stars
466
Forks
215
Avg merge
3d 10h
Merged PRs (30d)
7

Description

Hi,
When you add support for secrets on a isolated functions there is an inconsistency of how the override is managed between the host and the worker:
- on the host the "local.settings.json" configuration provider is added before the secrets configuration provider so the values in secrets overrides the values in "local.settings.json"
- on the worker as the values from "local.settings.json" are given as environment variables and those are added after the secrets configuration provider so on the worker it is the "local.settings.json" values which overrides the secrets.

A workaround is to not define the value in"local.settings.json" but still a developer cannot locally override a value from "local.settings.json".

To reproduce the issue you can to define in "local.settings.json" an empty value for "APPLICATIONINSIGHTS_CONNECTION_STRING" and override it in the secrets with a real value: the logs from the hosts are sent to application insights but the logs from the worker aren't.

Is there anyway to have the same behavior and have the secrets override the "local.settings.json" on the worker?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the APPLICATIONINSIGHTS_CONNECTION_STRING case described with an empty local.settings.json value and a secrets override. Trace how configuration providers are ordered on the host and worker, then verify that the worker gives secrets precedence over local.settings.json values.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp
Domain
backend, cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.