How to: List all Release Definitions and their latest executions on Azure DevOps

  1. PowerShell script will receive the following parameters:
  • $PAT = Personal Access token to connect on Azure DevOps;
  • $Organization = Organization URL to list all Team Projects, Release Definitions and latest executions;
  • $Connstr = connection string to Azure SQL Database that stores the report information. To create this report, it’s necessary to create previously an Azure SQL Server and Database and run a script below:
$AzureDevOpsAuthenicationHeader = @{Authorization = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(":$($PAT)")) }$UriOrganization = "https://dev.azure.com/$($Organization)/"$uriProject = $UriOrganization + "_apis/projects?`$top=500"$ProjectsResult = Invoke-RestMethod -Uri $uriProject -Method get -Headers $AzureDevOpsAuthenicationHeaderForeach ($project in $ProjectsResult.value)
{
Write-Host $project.name
}
$uriReleaseDefinitions = $uriReleases + "$($project.id)/_apis/release/definitions?api-version=6.1-preview.4"    $ReleaseDefintionsResult = Invoke-RestMethod -Uri $uriReleaseDefinitions -Method get -Headers $AzureDevOpsAuthenicationHeader    Foreach ($releaseDef in $ReleaseDefintionsResult.value)    
{
Write-Host $releaseDef.name
}
$uriLatestRelease = $uriReleases + "$($project.id)/_apis/release/releases?definitionId=$($releaseDef.id)&queryOrder=descending&`$top=1&`$expand=environments&api-version=6.0"        $LatestReleaseResult = Invoke-RestMethod -Uri $uriLatestRelease -Method get -Headers $AzureDevOpsAuthenicationHeader        if ($LatestReleaseResult.count -gt 0)        
{
Write-Host $LatestReleaseResult.value[0].name
}
  • Project Name (1) = Filter report using Project Name field;
  • Release Definition Name (2) = Filter report using Release Definition Name field;
  • Release Environment Name (3) = Filter report using Release Environment Name field;
  • Release Environment Result (4) = filter report using Release Environment Result field;
  • Requested For (5) = filter report using Requested For field;
  • Release Definitions and latest executions (6) = List all information about Team Projects, Release Definitions, Environment Name, Release Number, Release Start Time, Release Result, Release Requested For, and respective Link to redirect it to Azure DevOps;
  • Charts (7) = Charts to view aggregate information about this report.

--

--

--

Tech Solution Architect Manager na Accenture

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Pair Programming

What is Microsoft’s Azure Synapse Analytics?

Kubernetes deployment of multi-stage pipeline tasks using Redis

A Comparative Study on Sorting Algorithms

Python Practice Question & Solution

How to: List all Release Definitions, Stages, and Approvers on Classic Releases in Azure DevOps

Daily XAUUSD Price Action Analysis— 19 AUG 2021

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Vinicius Moura

Vinicius Moura

Tech Solution Architect Manager na Accenture

More from Medium

How to: Team Projects, Fields, and Picklists Mapping on Azure DevOps

Azure Sphere

Create Azure Purview using Bicep

Event-driven: Azure Functions and Logic Apps