ChangeVault
Integrations

Azure Pipelines

Automatically log changes to ChangeVault from your Azure Pipelines.

Overview

Use the ChangeVault API inside an Azure Pipelines YAML pipeline to automatically log deployments and infrastructure changes.

Setup

1. Store your API key as a variable

In Azure DevOps, go to your Pipeline → Edit → Variables and add a new variable:

  • Name: CHANGEVAULT_API_KEY
  • Value: your API key from the ChangeVault dashboard
  • Check Keep this value secret

2. Add the pipeline step

- script: |
    curl -X POST https://app.changevault.dev/api/changes \
      -H "x-api-key: $(CHANGEVAULT_API_KEY)" \
      -H "Content-Type: application/json" \
      -d '{
        "title": "Deployed $(Build.Repository.Name) @ $(Build.SourceVersion)",
        "risk_level": "low",
        "status": "completed",
        "tags": ["deploy", "azure-pipelines"]
      }'
  displayName: Log deployment to ChangeVault

Full pipeline example

trigger:
  branches:
    include:
      - main

pool:
  vmImage: ubuntu-latest

variables:
  - name: CHANGEVAULT_API_KEY
    value: $(CHANGEVAULT_API_KEY)  # set in pipeline variables

stages:
  - stage: Deploy
    displayName: Deploy to production
    jobs:
      - job: DeployJob
        displayName: Deploy
        steps:
          - checkout: self

          - script: echo "Your deploy step here"
            displayName: Deploy application

          - script: |
              curl -X POST https://app.changevault.dev/api/changes \
                -H "x-api-key: $(CHANGEVAULT_API_KEY)" \
                -H "Content-Type: application/json" \
                -d "{
                  \"title\": \"Deployed $(Build.Repository.Name) to production\",
                  \"description\": \"Commit: $(Build.SourceVersion)\nTriggered by: $(Build.RequestedFor)\",
                  \"risk_level\": \"low\",
                  \"status\": \"completed\",
                  \"tags\": [\"deploy\", \"production\", \"azure-pipelines\"]
                }"
            displayName: Log successful deploy to ChangeVault
            condition: succeeded()

          - script: |
              curl -X POST https://app.changevault.dev/api/changes \
                -H "x-api-key: $(CHANGEVAULT_API_KEY)" \
                -H "Content-Type: application/json" \
                -d "{
                  \"title\": \"Failed deploy: $(Build.Repository.Name)\",
                  \"description\": \"Commit: $(Build.SourceVersion)\nTriggered by: $(Build.RequestedFor)\",
                  \"risk_level\": \"high\",
                  \"status\": \"rolled_back\",
                  \"tags\": [\"deploy\", \"failed\", \"azure-pipelines\"]
                }"
            displayName: Log failed deploy to ChangeVault
            condition: failed()

Useful Azure Pipelines variables

VariableDescription
$(Build.Repository.Name)Repository name
$(Build.SourceVersion)Full commit SHA
$(Build.SourceBranchName)Branch name, e.g. main
$(Build.RequestedFor)Display name of the user who triggered the build
$(Build.BuildNumber)Pipeline run number
$(Release.EnvironmentName)Target environment name (classic release pipelines)

API access requires the Pro plan or higher.

On this page