Skip to content

Detect change in KeyVault references #248

Description

@pratyushoak

I have an Azure Function, where we use Azure App Configuration to pull a certificate from our KeyVault. The AppConfiguration to KeyVault reference has been setup. The AppConfiguration registration looks something like this -

aadConfigBuilder.AddAzureAppConfiguration(options =>
            {
                options.Connect(Environment.GetEnvironmentVariable("AppConfiguration:ConnectionString"))
                    .ConfigureKeyVault(kv =>
                       {
                           kv.SetCredential(new DefaultAzureCredential());
                       })
                    .Select("ExternalSystemAuthentication:AadConfig:*")
                       .ConfigureRefresh(refreshOptions =>
                            refreshOptions
                            /* .Register("ExternalSystemAuthentication:AadConfig:AuthCert", refreshAll: true) */ // want to detect when this changes
                            .Register("ExternalSystemAuthentication:AadConfig:Sentinel", refreshAll: true) // this works as expected
                            .SetCacheExpiration(TimeSpan.FromMinutes(2)));
                configurationRefresher = options.GetRefresher();
            });

Everything works as expected when I use a value based 'Sentinel' key to detect a change in config. However, in my case I have auto-rotation setup on the KeyVault certificate. When a new version is available, I want the latest version to be pulled into my Function. However, since the KeyVault reference is just a URL its value does not change in the AppConfiguration, and this key cannot be used as the observable key. So I am forced to manually update the 'Sentinel' so that my function can refresh config. Is there a way App Configuration can detect a change in the KV secret value? Or is there a way I can force refresh of the App Configuration periodically without checking for a change in any key?
Thanks.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions