I have a Key-vault storage connected to my Azure functions app. I can access values as environment variables when put references into application settings:
But I also have a custom configuration file in Json format. I read it in my Startup class:
public override void Configure(IFunctionsHostBuilder builder)
{
var envName = Environment.GetEnvironmentVariable("ENVIRONMENT_NAME");
var config = new ConfigurationBuilder()
.SetBasePath(builder.GetContext().ApplicationRootPath)
.AddJsonFile($"server.settings.{envName}.json", optional: false, reloadOnChange: false)
.AddEnvironmentVariables()
.Build();
MyConfig mainConf = new();
config.Bind("MyConfig", mainConf);
builder.Services.AddSingleton(mainConf);
}
One item in this file refers to the same secret:
"SecretDir": "@Microsoft.KeyVault(SecretUri=https://...)"
This value does not become interpolated. I see the reference instead of referenced value. How can I fix that?