I want to use an Azure App Configuration store in a .Net Framework MVC web app. I have added references to the Microsoft.Extensions.Configuration.* assemblies. The goal is that my existing code which makes calls to ConfigurationManager.AppSettings["key"] should continue to work and simply retrieve values from Azure when they are available.
I have registered a new configBuilder in web.config, as such:
<add name="MyConfigStore" mode="Greedy" connectionString="xxx" type="Microsoft.Configuration.ConfigurationBuilders.AzureAppConfigurationBuilder, Microsoft.Configuration.ConfigurationBuilders.AzureAppConfiguration" />
This works at runtime. However, during app initialization, in Startup.cs or Global.asax or when my DI container is built, the Azure configuration values are not found. It seems the Azure configBuilder is not yet registered. If I explicitly retrieve values from Azure, it works. If I simply call ConfigurationManager.AppSettings, it does not work.
IConfigurationRoot configuration = new ConfigurationBuilder()
.AddAzureAppConfiguration(options =>
{
options.Connect(ConfigurationManager.AppSettings["AzureConfigConnString"])
.UseFeatureFlags();
}).Build();
//THIS WORKS
var someValue = configuration["key"];
//THIS DOES NOT WORK
someValue = ConfigurationManager.AppSettings["key"];
How can I register the Azure configBuilder so that it is used during Startup? All of the examples seem to be for .Net Core and they use CreateHostBuilder() which doesn't exist in my project.