0
votes

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.

2
Not get your response for several days. What configuration do you want to update, please describe in detail.Hugh Lin
@HughLin-MSFT, Sorry for the late response. I am delpoying the API to a Kubernetes Cluster using AKS through Azure Pipelines. The database connection strings are in 'appsettings.json'. 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.Sreelal T
You can use Replace Tokens extension to replace the database connection string in appsettings.json. Please view the below answer.Hugh Lin

2 Answers

0
votes

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