How to: Build Definitions and Tasks Mapping 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, Build Definitions, and Build Tasks;
  • $Connstr = connection string to Azure SQL Database that stores the report information. To create this report, it’s necessary to create previously a Azure SQL Server and Database and run a script below:
$AzureDevOpsAuthenicationHeader = @{Authorization = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(":$($PAT)")) }$UriOrganization = "$($Organization)/"$uriProject = $UriOrganization + "_apis/projects?`$top=500"$ProjectsResult = Invoke-RestMethod -Uri $uriProject -Method get -Headers $AzureDevOpsAuthenicationHeaderForeach ($project in $ProjectsResult.value)
Write-Host $
$uriBuildDefinitions = $UriOrganization + "$($"    $BuildDefintionsResult = Invoke-RestMethod -Uri $uriBuildDefinitions -Method get -Headers $AzureDevOpsAuthenicationHeader    Foreach ($builDef in $BuildDefintionsResult.value)
Write-Host $
$uriBuildDef = $UriOrganization + "$($$($"        $BuildDefResult = Invoke-RestMethod -Uri $uriBuildDef -Method get -Headers $AzureDevOpsAuthenicationHeaderWrite-Host $BuildDefResult.process.phases
$uriTaskName = $UriOrganization + "_apis/distributedtask/tasks/$($"                $TaskNameResult = Invoke-RestMethod -Uri $uriTaskName -Method get -Headers $AzureDevOpsAuthenicationHeaderWrite-Host $TaskNameResult.value[0].name
  • Task Name (1) = Filter report using Task Name field;
  • Team Project Name (2) = Filter report using Team Project Name field;
  • Build Definition Name (3) = filter report using Build Definition Name field;
  • Build Definitions and Tasks Mapping Information (4) = List all information about Build Tasks, Project Name, Definition Name, and Number of usages from a respective task;
  • Number of usages = Looking at the example above, the DotNetCoreCli task is being used 4 times in the Build Definition ANP.Admin CI.




Tech Solution Architect Manager na Accenture

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

Recommended from Medium

Grid / Batch / Secure / Cloud / Fun / Powerful Computing with Civis Platform

Azure Security Validations with Secure DevOps Kit (AzSK)

Lambda Execution Leaks: A Practical Guide | Lumigo

Location-based check-ins — yay or nay?

Screenshot of feedback from users: e.g. “Can TraceTogether App do auto check-out when it detects that I’ve moved away?”, “Can TraceTogether App list SafeEntry venues based on my global positioning service (GPS) location, like how Singpass App does it?”

GoDaddy sells PlusServer for $456M, kills off its AWS-style cloud services

4 cool updates in Columns: Canceled cards, custom card style, dynamic column width and a new…

How to Build Your Personal AI Assistant Using Python

Git Change file permissions

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: Including a bunch of Work Items on Azure DevOps

How to extend an Azure DevOps YAML Pipeline Template

Create Azure Purview using Bicep

Test Azure Terraform code with Terratest