3

My pipeline in Azure DevOps do the following:

enter image description here

  1. Bash script: to avoid problem that database cannot be removed( Azure PostgreSQL: it is not possible to remove database through Azure CLI )

  2. Azure Key Vault: Obtain Key Vault variables for login to PostgreSQL database

  3. Azure CLI: Remove database using Azure CLI;
  4. NPM install: initialize NodeJS packages from package.json
  5. NPM run: start apply.js file which connects to PostgreSQL, create database, and apply schema using liquibase;

apply.js uses some environment variables like DB_HOST,DB_PASSWORD, DB_USER, which are stored in Variable Group, however, the password in Key Vault is stored as postgres-password variable. So, the problem is how to save KV postgres-admin-password variable into common DB_PASSWORD variable.

Is there any way to do this?

Shayki Abramczyk
  • 36,824
  • 16
  • 89
  • 114
DariyN
  • 466
  • 1
  • 6
  • 23

1 Answers1

1

You can add a PowerShell inline task that set the DB_PASSWORD value like the postgres-admin-password:

Write-Host "##vso[task.setvariable variable=DB_PASSWORD;]$(postgres-admin-password)"
DariyN
  • 466
  • 1
  • 6
  • 23
Shayki Abramczyk
  • 36,824
  • 16
  • 89
  • 114