question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Consider adding support for hierarchical configuration in local.settings.json

See original GitHub issue

We are planning to use a hierarchical configuration to support different modes of connecting to the service by having.

This is the current shape of settings:

{
    "Values": {
      "StorageConnection": "UseDevelopmentStorage=true",
    }
}

This is what we want to support for AAD auth.

{
    "Values": {
        "StorageConnection": {
            "endpoint": "https://pakrym0test0storage.blob.core.windows.net/",
        }
    }
}

Considering that functions runtime uses IConfiguration that already supports hierarchical data but we need to make sure values gets there in the correct shape. AppSettingsFile would need to change to support this.

Setting reading would need to change https://github.com/Azure/azure-functions-core-tools/blob/28be3f19626161c5cca94d2d4376a2a3350c923b/src/Azure.Functions.Cli/Common/AppSettingsFile.cs#L11

Currently, it’s possible to work around the absence of the feature by using the ASP.NET Core double underscore syntax (https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/?view=aspnetcore-3.1#environment-variables)

{
    "Values": {
        "StorageConnection__endpoint": "https://pakrym0test0storage.blob.core.windows.net/"
    }
}

cc @fabiocav @mattchenderson @paulbatum

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
evilpilafcommented, Nov 11, 2020

It’s specially difficult given the lack of documentation around this subject

1reaction
evilpilafcommented, Nov 11, 2020

I get that the __ notation is not common for .net developers but it is the recommended way in the documentation for hierarchical environment variables for netcore projects, it’s very frustrating to have it not work at all when trying to port an existing application to a function and then needing to unravel all your appsettings.Development.json, being unable to map my local settings to a strongly typed POCO for consumption within my project is very frustrating as well

Read more comments on GitHub >

github_iconTop Results From Across the Web

Azure Functions local.settings.json Secrets and Source ...
settings.json is that we are now able to safely add all of the settings that our functions are dependent on to source control....
Read more >
App settings reference for Azure Functions
Reference documentation for the Azure Functions app settings or environment variables used to configure functions apps.
Read more >
Part 2] A deeper dive into Azure Functions configuration
This is part two of a series exploring .NET Core configuration, with an emphasis on Azure Functions. In this article, we review how ......
Read more >
Configuration in Azure Functions - What's in the box?
The first in a series of posts talking about how to best work with configuration in Azure Functions.
Read more >
Different host.json for Debug and Release for Azure ...
When the runtime finds an application setting in the format AzureFunctionsJobHost__path__to__setting, it overrides the equivalent host.json ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found