I have a function app, the app settings has several different PATs One of the function is an HTTP trigger, the request body will contain a specific name and that name should be used to retrieve the corresponding PAT from app settings
I have tried Environment.GetEnvironmentVariable, this doesnt seem to read from app settings at all
I have tried
var configuration = builder.GetContext().Configuration;
var pat = configuration[$"{name}_PAT"];
this was a struggle because the {name} is only available after the POST request comes in, and configuration read the app settings in startup.cs, which is before the function getting triggered
I also cant use configuration after the request had come in because of the {name} and public abstract void Configure(IFunctionsHostBuilder builder) from FunctionsStartup doesn't have any forms that would take a string that's needed for the {name}




configuration read the app settings in startup.cs, which is before the function getting triggered- maybe try converting a section fromappsettings.jsoninto a Dictionary? See stackoverflow.com/a/45673985/558486.appsettings.json? because the app settings I have all the PATs in is on portal. Creating a dictionary on the portal is the double underscore right? I assume it'd look like PAT__companyA, PAT__companyB, PAT__companyC. If i do avar pat = configuration["PAT"], would it retrieve all three of them?"PAT": { "Foo": "xxx", "Bar": "yyy" }then yes, you can access its values using environment variablesPAT__FooandPAT_Bar. Using this solution you should be able to create a dictionary for sectionPAT.