Pull App Configuration values from Azure

Joel Palmer 1 Reputation point

.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 =>
                                .ConfigureKeyVault(kv =>
                                    kv.SetCredential(new DefaultAzureCredential());
                                .Select(KeyFilter.Any, LabelFilter.Null)
                                .Select(KeyFilter.Any, "Debug");
                                .Select(KeyFilter.Any, "Deployed");

I need to pull these values into a WPF application. How?

Azure App Configuration
Azure App Configuration
An Azure service that provides hosted, universal storage for Azure app configurations.
185 questions
No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Samara Soucy - MSFT 4,936 Reputation points

    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 =>  
                        .ConfigureRefresh(refresh =>  
                        _refresher = options.GetRefresher();  
            _configuration = builder.Build();  
            //continue on with your startup  
  2. Joel Palmer (JLPM) 141 Reputation points

    Thank you for your help. This is close to what I've discovered.