Search code examples
azure-devopsazure-pipelinesazure-pipelines-release-pipelineazure-devops-rest-api

ADO Rest API to query the current deployed release id?


Is there an ADO Rest API which let me to query the "currently deployed" release id of a release definition?

I tried to look in https://learn.microsoft.com/en-us/rest/api/azure/devops/release/?view=azure-devops-rest-6.1, but I only find a call to list all release. I am look for the one which is currently deployed.


Solution

  • You can check out Deployments - List rest api to get the currently deployed release id.

    You can use the query parameters to query the currently deployed release id of a specific stage of a specific release pipeline.

    See below example: Using additional parameters definitionId,deploymentStatus,definitionEnvironmentId(ig.stage id.),$top

    `https://vsrm.dev.azure.com/org/proj/_apis/release/deployments?definitionId=3&deploymentStatus=succeeded&definitionEnvironmentId=5&$top=1&api-version=6.1-preview.2`
    

    Note: You can get the definitionId, definitionEnvironmentId from the url of the releae pipeline.

    enter image description here

    If you are using powershell script to call above rest api. You need to escape the $ in $top parameter by adding a back tick "`$top".