2

I am trying to load some key/value pairs defined in my Azure App Configuration service inside my DotNet 6.0 web application. But it returns nothing [ the call to builder.Configuration.GetSection("Rental:Settings")].Any Idea?

Here is the code I am using:

builder.WebHost.ConfigureAppConfiguration((ctx, config) =>
{
    var settings = config.Build();
    if (ctx.HostingEnvironment.IsDevelopment())
    {
        config.AddAzureAppConfiguration(c=>
        {
            c.Connect(ConnectionString); // Copied from Access key section 
        });
    }   
});

Load it into a class:

builder.Services.Configure<AppSetings>(**builder.Configuration.GetSection("Rental:Settings")**);

Key/Value

enter image description here

Reza Shirazi
  • 359
  • 5
  • 17

1 Answers1

3

This is the same issue as https://github.com/MicrosoftDocs/azure-docs/issues/105624. By default, the library loads key-values with "no label", but key-values you created have labels. Use the Select API to specify the label you want to load.

config.AddAzureAppConfiguration(options =>
{
    options.Connect(connectionString)
           .Select("*", "replace with your label");
});
Zhenlan Wang
  • 1,213
  • 8
  • 10