How to persist Azure App Configuration changes to appsettings.json

Lilley, Kristopher L 0 Reputation points
2023-10-16T19:24:16.18+00:00

I have set up dynamic updates for an asp.net 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.
208 questions
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,180 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Pramod Valavala 20,591 Reputation points Microsoft Employee
    2023-10-25T16:25:42.7066667+00:00

    @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
    2024-01-24T00:04:27.34+00:00

    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