I have some .NET Framework 4.6.2 Web applications that I am trying to implement with Azure Keyvault for my organization. The applications live on-prem. Our app has web.config
files for multiple environments (DEV, QA, TEST, PROD, etc.). There are some connectionStrings
and appSettings
, whose values we need to store in the KeyVault. All the environments have the same config keys in their web.config
but the values are just environment specific.
Throughout the application our config keys are read like so: ConfigurationManager.AppSettings["ApiKey"]
and ConfigurationManager.ConnectionStrings['DbContext'].ConnectionString
.
I already have the keyvault setup and the secrets created just having trouble setting them in the ConfigurationManager
. We want to be able to, on application startup, override the values for these keys with the secrets from the keyvault. The catch is that the values for the secrets should not be written to the web.config
files. Is that possible or do we need some other Configuration implementation? We don't want to have to continuously interrogate Azure for the config setting. That is why we decided to do it once on startup and save to memory somehow. Once we hit Azure on startup we won't do it again until the next time the application is started.
Unfortunately, I cannot update these web applications to .NET Framework 4.7.1 at this time.
The existing microsoft documentation isn't really helpful for those of us still on older .NET Framework versions.
My apps are using Global.asax
instead of the Startup.cs
or Program.cs
if that matters.