-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEATURE REQ] - Azure Keyvault AddAzureKeyVault.ReloadInterval needs to raise an Event #11671
Comments
Secret configuration provider already fires configuration system reload token: https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/extensions/Azure.Extensions.AspNetCore.Configuration.Secrets/src/AzureKeyVaultConfigurationProvider.cs#L141 You can use https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.configuration.iconfiguration.getreloadtoken?view=dotnet-plat-ext-3.1#Microsoft_Extensions_Configuration_IConfiguration_GetReloadToken to retrieve the reload token. An article about using change tokens https://docs.microsoft.com/en-us/aspnet/core/fundamentals/change-tokens?view=aspnetcore-3.1 |
Thanks. Bizzarely complex, but it works! Thanks! |
20201113 streamanalytics (Azure#11671) * sdk-no-flatten * use unique jobName is examples
@JohnGalt1717 Could you share how you configured azure keyvault configuration provider to reload stuff on change? |
Here's my complete implementation:
ReloadInterval = is the key to it just doing it automatically from what I can tell. In the past I had to do WAY more work to get it to reload using the old library. |
Why are these needed? var tKeyVaultSource = options.GetType().Assembly.GetType("Azure.Extensions.AspNetCore.Configuration.Secrets.AzureKeyVaultConfigurationSource")!; var source = Activator.CreateInstance(tKeyVaultSource, new object[] { client, options }) as IConfigurationSource; config.Sources.Insert(0, source); |
That puts Azure Keyvault first instead of last in the order of configuration providers because literally everything else should come after it for overriding your keyvault. If you don't do this, then command line, environment variables and even .config files will be ignored. Typically you'll want to have specific settings in environment variables in docker as an example that override certain values per environment. (and Microsoft made the class you need internal so you have to use reflection to get at it) |
Thanks @JohnGalt1717 ! |
Library or service name.
Microsoft.Extensions.Configuration.AzureKeyVault
Is your feature request related to a problem? Please describe.
Recently the ReloadInterval property was added which is great, but it doesn't go far enough because we have no way of knowing that it occured and respond and update the strongly bound configuration singletons etc in our DI.
What feature would you like to get added? What problem is it solving?
Please add an event to the AddAzureKeyVault method that allows us to specify a function/lambda that can reload these singletons as a result of a reload from Azure.
The text was updated successfully, but these errors were encountered: