July 5, 2016

Has Code, Uses KeyVault, Now Update!

This is the 'but wait there's more' from my previous post. Now that you are storing your secrets in KeyVault instead of hard coding them, how do you change those secret values when it is time?

Just set the value over it!

$ss = ConvertTo-SecureString 'my new APICode' -AsPlainText -Force set-AzureKeyVaultSecret -VaultName 'MyKV' -Name 'APICode' -SecretValue $ss

You'll get a new ID because it is a new version, but because I'm not storing the full portion (which is the version bit) in my AppSettings, things will just keep on trucking.

"But hey there Derek, I changed my value in KeyVault but my MVC site doesn't seem to have the new value in it," you say with exasperation. Remember, it's a static variable in my example - that value is static until the app pool restarts. So hit the restart button on your App in Azure and calm down. :)