{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":32100,"path":"it-service-management/devops-change-velocity/dev-ops-azure-change-control-api.md","title":"Configuring change control using the Azure Invoke REST API","bundle":null,"doc_type":null,"release":"australia","body":"\n# Configuring change control using the Azure Invoke REST API\n\nYou can use the Azure Invoke REST API in your YAML or Classic Azure pipeline to configure change control for DevOps.\n\nYou must enable the **This property decides whether to create a Generic Connection on configure operation for Azure DevOps** property to use Invoke REST API.\n\nFor Azure Invoke REST API details, visit the [Microsoft documentation site](http://docs.microsoft.com) and search for [`Invoke HTTP REST API task- Azure Pipelines`](https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/invoke-rest-api-v1?view=azure-pipelines&tabs=yaml).\n\n**Important:**\n\nIf 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.\n\n## Generic service connection\n\nUsing the Azure Invoke REST API requires the creation of a generic service connection in Azure DevOps.\n\n\\[Omitted image \"dev-ops-azure-api-change-conn.png\"\\] Alt text: Azure YAML REST API change control connection\n\n## YAML Azure pipeline\n\nIn Azure DevOps, a server task must be created with the service connection as the change control endpoint.\n\n<table id=\"table_yjj_5mp_wmb\"><thead><tr><th>\n\nAzure pipeline type\n\n</th><th>\n\nValues\n\n</th></tr></thead><tbody><tr><td>\n\nBuild\n\n</td><td>\n\n-   buildNumber\n-   isMultiBranch\n-   branchName\n\n</td></tr><tr><td>\n\nRelease\n\n</td><td>\n\n-   releaseNumber\n-   projectName\n\n</td></tr></tbody>\n</table>**Note:** For release pipelines, set the **Pre-deployment conditions** &gt; **Advanced** &gt; **Completion event** field to Callback.\n\nBuild pipeline:\n\n```\n\n- task: InvokeRESTAPI@1\n      inputs:\n        connectionType: 'connectedServiceName'\n        serviceConnection: 'change1'\n        method: 'POST'\n        body: |\n         {\n            \"buildNumber\": \"$(build.buildId)\",\n            \"isMultiBranch\": \"true\",\n            \"branchName\": \"$(build.sourceBranchName)\"\n         }\n        waitForCompletion: 'true'\n```\n\nRelease pipeline:\n\n```\n\n- task: InvokeRESTAPI@1\n      inputs:\n        connectionType: 'connectedServiceName'\n        serviceConnection: 'change1'\n        method: 'POST'\n        body: |\n         {\n            \"releaseNumber\": \"$(Release.ReleaseId)\",\n            \"projectName\": \"$(System.TeamProject)\"\n         }\n        waitForCompletion: 'true'\n```\n\n## Classic Azure pipeline\n\nFor a Classic Azure pipeline, an Invoke REST API server task must be added.\n\n\\[Omitted image \"dev-ops-azure-api-change-classic.png\"\\] Alt text: Azure Pipeline Invoke REST API change control\n\n\\[Omitted image \"dev-ops-azure-api-chg-rel-classic.png\"\\] Alt text: DevOps Azure classic release pipeline\n\n**Parent Topic:**[Azure DevOps integration with DevOps Change Velocity](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/it-service-management/devops-change-velocity/azure-devops-integration-dev-ops.md)\n\n"}}