Dynamic configuration in ASP.NET Core
So far, we have explored static configuration implementation – which means we need to restart the application to use the updated values. We can use the dynamic configuration option as well – which means not needing to restart the application to get the updated values. To implement dynamic configuration, we need to add a Sentinel key. A Sentinel key is a key that we need to modify once all other keys have been updated. We will configure our application to monitor this key, and if there is any update, reload all the other configurations.
So, let us add the Sentinel key using the Azure CLI:
> az appconfig kv set --name Chapter09 --key "Sentinel" --value "1" --yes
Next, we need to modify the ASP.NET Core project’s Program.cs
file, where we are connecting to Azure App Configuration like this:
builder.Configuration.AddAzureAppConfiguration(options => { options...