I'm doing an Azure App Service Deploy (ASP.NET Core 2.0 Web Api) in Visual Studio Team Services and want to replace some values in the appsettings.json so I read https://docs.microsoft.com/en-us/vsts/build-release/tasks/transforms-variable-substitution#jsonvarsubs, but they talk about substituting values in nested levels of the file, by concatenate the names with a period (.).
Problem is that you can't use periods (.) in an Azure Key Vault.
Does anyone know how to substitute variables with nested levels in an appsettings.json file using Secrets from the Azure Key Vault?
I ended up using 'ConnectionStrings--Database' as Secret key in Azure Key Vault.
Then adding a 'Variable Group' in VSTS (https://docs.microsoft.com/en-us/vsts/build-release/concepts/library/variable-groups) linking to the Azure Key Vault.
And add a 'Process Variable' called ConnectionStrings.Database with a value of '$(ConnectionStrings--Database).
That way it replaces the value of your 'Process Variable' with the value from the Azure Key Vault and it uses the name of the 'Process Variable' to replace in the appsettings.json.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With