Azure Pipelines logo It’s easy to open a specific release definition in the Azure DevOps web UI to find out what builds it references, but you can’t do the opposite - open a build to see which release definitions rely on it.

Last time we got a list of Azure Pipelines Release Definitions. Let’s go the next step and match up the builds that are being consumed by each release definition. With this list, we can now filter down to a build and find which releases use it.

See Personal access tokens for instructions on how to create the personal access token.

param (
    [string] $organisation,
    [string] $personalAccessToken

$base64AuthInfo= [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$($personalAccessToken)"))
$headers = @{Authorization=("Basic {0}" -f $base64AuthInfo)}

$result = Invoke-RestMethod -Uri "$organisation/_apis/projects?api-version=6.0" -Method Get -Headers $headers

$projectNames = $

$projectNames | ForEach-Object {
    $project = $_

    $result = Invoke-RestMethod -Uri "$organisation/$project/_apis/release/definitions?api-version=6.1-preview.4&`$expand=artifacts" -Method Get -Headers $headers

    $result.value | Select-Object name, 
        @{ Name = "Url"; Expression = { $_._links.web.href }},
        @{ Name="Artifacts"; Expression= { $_.artifacts.alias }}, 
        @{ Name="artifactSourceDefinitionUrl"; Expression= { $ }}

This script also makes use of the Definitions - List REST API. This time we’re requesting the artifacts property to be included in the results. It is this property that contains information about builds and their artifacts that are being consumed by the release definition.