How to: Process Templates, Work Item Types and Custom Rules 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 Process Templates, Work Item Types and Custom Rules;
  • $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)/"  $uriProcess = $UriOrganization + "_apis/work/processes/"$processesResult = Invoke-RestMethod -Uri $uriProcess -Method get -Headers $AzureDevOpsAuthenicationHeader$inheritedProcess = $processesResult.value | Where-Object {$_.customizationType -eq 'inherited'}if ($inheritedProcess.Count -gt 0)
{
Foreach ($process in $inheritedProcess)
{
Write-Host $process.name
}
}
$uriWorkItemTypes = $uriProcess + "$($process.typeId)/workitemtypes/"$workItemTypesResult = Invoke-RestMethod -Uri $uriWorkItemTypes -Method get -Headers $AzureDevOpsAuthenicationHeader        Foreach ($wit in $workItemTypesResult.value)        
{
Write-Host $wit.name
}
$uriRules = $uriWorkItemTypes + "$($wit.referenceName)/rules?api-version=6.0-preview.2"            $rulesResult = Invoke-RestMethod -Uri $uriRules -Method get -Headers $AzureDevOpsAuthenicationHeader            $customRules = $rulesResult.value | Where-Object {$_.customizationType -eq 'custom'}            if ($customRules)            
{
Foreach ($rule in $customRules)
{
Write-Host $rule.name
}
}
  • Process Template (1) = Filter report using Process Template field;
  • Work Item Type (2) = Filter report using Work Item Type field;
  • Process Templates, Work Item Types and Custom Rules (3) = List all information about Process Template, Work Item Type, Custom Rule Name, Condition Type, Condition Field, Condition Value, Action Type, Action Field, and Action Value.

--

--

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