Configuring change control using the Azure Invoke REST API
You can use the Azure Invoke REST API in your YAML or Classic Azure pipeline to configure change control for DevOps.
You must enable the This property decides whether to create a Generic Connection on configure operation for Azure DevOps property to use Invoke REST API.
For Azure Invoke REST API details, visit the Microsoft documentation site and search for Invoke HTTP REST API task- Azure Pipelines.
Important:
If you have duplicate or reused job names in your pipeline execution steps, ensure that the stageName attribute contains azurestageName/jobName in it’s value, i.e. stageName = azureStageName/jobName. The artifact registration tasks send both stage and job names to associate the artifact version to the correct task execution.
Generic service connection
Using the Azure Invoke REST API requires the creation of a generic service connection in Azure DevOps.
Azure YAML REST API change control connection
YAML Azure pipeline
In Azure DevOps, a server task must be created with the service connection as the change control endpoint.
| Azure pipeline type | Values |
|---|---|
| Build | - buildNumber - isMultiBranch - branchName |
| Release | - releaseNumber - projectName |
Note: For release pipelines, set the Pre-deployment conditions > Advanced > Completion event field to Callback.
Build pipeline:
- task: InvokeRESTAPI@1
inputs:
connectionType: 'connectedServiceName'
serviceConnection: 'change1'
method: 'POST'
body: |
{
"buildNumber": "$(build.buildId)",
"isMultiBranch": "true",
"branchName": "$(build.sourceBranchName)"
}
waitForCompletion: 'true'
Release pipeline:
- task: InvokeRESTAPI@1
inputs:
connectionType: 'connectedServiceName'
serviceConnection: 'change1'
method: 'POST'
body: |
{
"releaseNumber": "$(Release.ReleaseId)",
"projectName": "$(System.TeamProject)"
}
waitForCompletion: 'true'
Classic Azure pipeline
For a Classic Azure pipeline, an Invoke REST API server task must be added.
Azure Pipeline Invoke REST API change control
DevOps Azure classic release pipeline
Parent Topic:Azure DevOps integration with DevOps Change Velocity