I have a .NET 6 Web Api deployed on AKS and I'm trying to use the Dynamic configuration to reload settings from Azure App Configuration without needing to restart the Pod.
When the Pod is deployed, changes made to settings (shortly after deploying the Pod) on Azure App Configuration are picked up by my app. However, if I come the next day lets say and I update a setting on Azure App Config then this is not picked up by the Web Api. The same happens for Feature Flags updates.
Code and setup:
Azure App Config

Program.cs
builder.Host.ConfigureAppConfiguration(config =>
{
config.AddAzureAppConfiguration(option =>
option.Connect(appConfigConnString)
.ConfigureRefresh(refreshOptions =>
{
refreshOptions.Register("AppSettings:TestReloadTesting", refreshAll: true);
refreshOptions.SetCacheExpiration(TimeSpan.FromSeconds(5));
})
.ConfigureKeyVault(kv => kv.SetCredential(new DefaultAzureCredential(defaultAzureCredentialOptions)))
.UseFeatureFlags(options =>
{
options.Label = "Feature-flag-label";
options.CacheExpirationInterval = TimeSpan.FromSeconds(5);
})
);
});
builder.Services.AddAzureAppConfiguration();
builder.Services.AddFeatureManagement(builder.Configuration.GetSection("FeatureManagement"));
...........
var app = builder.Build();
app.UseAzureAppConfiguration();
app.UseFeatureAvailability();
...........
Controller actions that reads the config settings and Feature flags
[HttpGet("TestAppSetting")]
public ActionResult<Result> GetTestAppSettingReload()
{
var result = _appsettings.TestReloadTesting;
return new Result{ TestReloadTesting = result };
}
[HttpGet("TestFeature")]
public async Task<ActionResult<string>> GetTestFearureFlag()
{
var result = await _featureManager.IsEnabledAsync("feature-name");
return Ok(result);
}
I don't get any errors whatsoever and I have looked at the documentation but haven't found anything related to that.
in your code, can you do the following to see if it works: