How to: Process Templates, Work Item Types, and Fields Mapping on Azure DevOps

Vinicius Moura
3 min readJun 21, 2021

This script and report extract all Process Templates, Work Item Types, and Fields within the Azure DevOps organization

Many customers that use Azure DevOps prefer to change System Process Templates (Agile, Basic, Scrum, and CMMI), thus creating your own process using a feature Customize Process Templates. Therefore, it’s possible to create new work item types, fields, rules, etc.

But when you have different Process Templates, Work Item Types, and Fields, it is often necessary to identify where each field is used, to avoid creating duplicate fields. Thinking about mapping process templates in Azure DevOps, the following report was created:

An original script is available on my GitHub repository. See below this script:

Let’s go understand each command used.

  1. PowerShell script will receive the following parameters:
  • $PAT = Personal Access token to connect on Azure DevOps;
  • $Organization = Organization URL to list all Process Templates, Work Item Types, and Fields on Azure DevOps organization;
  • $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:

2. Process List = use this REST API to list all Process Templates on Azure DevOps organization

$AzureDevOpsAuthenicationHeader = @{Authorization = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(":$($PAT)")) } $UriOrganization = "https://dev.azure.com/$($Organization)/" $uriProcess = $UriOrganization + "_apis/work/processes/" $processesResult = Invoke-RestMethod -Uri $uriProcess -Method get -Headers $AzureDevOpsAuthenicationHeader Foreach ($process in $processesResult.value)
{
Write-Host $process.name
}

3. Work Item Types List = use this REST API to list all Work Item Types on each Process Template

$uriWorkItemTypes = $uriProcess + "$($process.typeId)/workitemtypes/"    $workItemTypesResult = Invoke-RestMethod -Uri $uriWorkItemTypes -Method get -Headers $AzureDevOpsAuthenicationHeader    Foreach ($wit in $workItemTypesResult.value)    
{
Write-Host $wit.name
}

4. Fields List = use this REST API to list all Fields on each Work Item Type and Process Template

$uriFields = $uriWorkItemTypes + "$($wit.referenceName)/fields"        $fieldsResult = Invoke-RestMethod -Uri $uriFields -Method get -Headers $AzureDevOpsAuthenicationHeader        Foreach ($f in $fieldsResult.value)        
{
Write-Host $f.name
}

5. After extract all Process Templates, Work Item Types, and Fields, this information is stored in a table in Azure SQL.

6. After insert information into a table, I connected this database on Power BI:

  • Process Template (1) = Filter report using Process Template field. In the example above, it’s possible to list all fields on the Agile Process Template;
  • Work Item Type(2) = Filter report using Work Item Type field;
  • Field Reference Name (3) = Filter report using Field Reference Name field. If you use this filter, it’s possible to identify all Process Templates and Work Item Types that use this field;
  • Process Customization Type (4) = Filter report using Process Customization Type (system or inherited) option;
  • Report Information (5) = List all information about Process Templates, Work Item Types, and Fields. If the respective field appears in this mapping, the same will be shown in the tooltip (green ticks on a grid).

--

--