How to persist Azure App Configuration changes to appsettings.json

Lilley, Kristopher L 0 Reputation points

I have set up dynamic updates for an 6 app. It uses the polling method and updates when the sentinel key changes. What I would like to do is persist the changes to the appsettings.json file whenever they occur.

I've looked at other options, like the push model with EventGrid, but while I would have the event handler running when the sentinel key gets updated, I would only have the information about the sentinel key change, and the refresh would still be done by the refresher as configured in Main (refreshing all, filtered by a label), so I wouldn't have the rest of the config changes to persist.

Not sure if I'm just missing something, but is there a way to get the full set of config key/values when the config changes so that I could update the appsettings file as well?

Azure App Configuration
Azure App Configuration
An Azure service that provides hosted, universal storage for Azure app configurations.
210 questions
A set of technologies in the .NET Framework for building web applications and XML web services.
4,237 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Pramod Valavala 20,591 Reputation points Microsoft Employee

    @Lilley, Kristopher L Apologies for the delay here! That makes sense.

    While there is no built-in way to do this, the SDK does do some caching which you can control with the SetCacheExpiration method but is still not a persistent way of doing this.

    I suppose the alternative would be to manually persist the current configuration into a file and use that as a source if Azure App Configuration is down/inaccessible.

    That being said, I would suggest creating a feature request for this to have the team consider it in the future.

  2. Carlos dos Santos 85 Reputation points Microsoft Regional Director

    Hi Lilley, Kristopher L I already use Azure KeyVault to persist App Configuration and you can as a midleware in .NET Core application. And changes in your code is minimum.

    0 comments No comments