0
votes

For deployment I use the task Azure App Service deploy in Azure DevOps. For save my variables I use variables group Azure DevOPs and use JSON variable substitution I overwrite the values in appsettings.json. For example section in appsettings.json

    "ConnectionStrings": {
        "DefaultConnection": "Azure DB Connection String"
        }
   }

And in variables groups I use ConnectionStrings.DefaultConnection "Azure DB Connection String"

Now I want to use Key Vault for these purposes. But when I created the variables in Key vault and connected it to Azure DevOps the value did not write to appsettings.json.

Could you please tell me how can I use Azure Key Vault in Azure DevOps deployment? I have a zip artifact. Thanks.

1

1 Answers

0
votes

There is no reason to be doing a configuration transformation at all for an application running in an Azure app service.

You have the values in a key vault. You have an Azure App Service. App services can retrieve values directly from the key vault (the method varies from language to language, but there's a NuGet package for .NET applications), or you can use the app service app settings section and put keyvault references in.

Even if you weren't using a key vault, there's no need for configuration transforms. Web app app settings are stored as environment variables and can be retrieved at runtime by whatever mechanism your language of choice uses to read environment variables.