0
votes

I want to cancel a specific deployment in Azure Devops using their REST API. I found an article where I can set the whole environment to cancelled, but I just want to cancel a specific deployment (not the latest). I cant find anything in their API reference under release or deployments.

Here is the API ref for the update of a release environment:

https://docs.microsoft.com/en-us/rest/api/azure/devops/release/releases/update%20release%20environment?view=azure-devops-rest-6.0

2

2 Answers

1
votes

The API you find is right. You can specify a certain deployment using releaseId and environmentId in URI Parameters. If you want to cancel the deployment, set the status to canceled in Request Body.

You can find the releaseId and environmentId in the URL of the release page:

enter image description here

0
votes

https://docs.microsoft.com/en-us/rest/api/resources/deployments/cancel

This document may be helpful for you

POST https://management.azure.com/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel?api-version=2020-06-01