Azure App Configuration
An Azure service that provides hosted, universal storage for Azure app configurations.
244 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
.NET 5 Core applications pulls App Configuration values from Azure by the following call in the Program.cs file.
webBuilder.ConfigureAppConfiguration((context, config) =>
{
var builtConfig = config.Build();
config.AddAzureAppConfiguration(options =>
{
options.Connect(builtConfig["AppConfigEndpoint"])
.ConfigureKeyVault(kv =>
{
kv.SetCredential(new DefaultAzureCredential());
})
.Select(KeyFilter.Any, LabelFilter.Null)
#if DEBUG
.Select(KeyFilter.Any, "Debug");
#else
.Select(KeyFilter.Any, "Deployed");
#endif
});
});
I need to pull these values into a WPF application. How?
It's very similar in other .NET development projects, but you will be calling ConfigurationBuilder instead of the web config builder:
private static IConfiguration _configuration = null;
private static IConfigurationRefresher _refresher = null;
static void Main(string[] args)
{
var builder = new ConfigurationBuilder();
builder.AddAzureAppConfiguration(options =>
{
options.Connect(Environment.GetEnvironmentVariable("ConnectionString"))
.ConfigureRefresh(refresh =>
{
refresh.Register("TestApp:Settings:Message")
.SetCacheExpiration(TimeSpan.FromSeconds(10));
});
_refresher = options.GetRefresher();
});
_configuration = builder.Build();
//continue on with your startup
}
Thank you for your help. This is close to what I've discovered.