Configuration Management in AKS Deployment with Azure Pipelines for Different Environments

1/10/2020

I have created a ASP.NET Core WebAPI and deployed in an Dev Environment (Kubernetes) using Azure Pipelines. How can I update the configuration in the pipeline if I need to publish the same API in another environment (eg. SIT). Since I have different settings/configuration for Dev and SIT environments. Kindly guide me.

-- Sreelal T
azure-devops
azure-kubernetes
azure-pipelines

2 Answers


1/14/2020

The problem occurs when I want to deploy the same API to other environments like QA/UAT/Prod. Since each environment is having separate databases

For this issue , there are several ways to achieve this. You can add Replace Tokens extension to the job to replace the database connection string in appsettings.json.

enter image description here

You can define your variable like below:

{
  "ConnectionStrings": {
    "DefaultConnection": "#{connectstring}#"
  }
}

You can refer to this case and lab for details.

Here are some reference for the same issue:

Replacing database connection strings in the Docker image

Set Json Property task to replace the ConnectionStrings

-- Hugh Lin - MSFT
Source: StackOverflow