How to: Viewing individual capacities on different projects, teams, and sprints in Azure DevOps

Vinicius Moura
3 min readOct 6, 2020

This script will extract individual capacities on Azure DevOps, showing teams, sprints, and activities

Oftentimes my customers ask me about individual capacities on Azure DevOps and if its possible to know in which sprints the same person is allocated in the same period of time, thus sharing their activities. Thinking exactly about this issue, I created a script and a report in PowerBI that was able to resolve it. Let’s go!

An original script is available on my GitHub repository. Let’s go understand each used command.

  1. PowerShell script will receive the following parameters:
  • $PAT = Personal Access token to connect on Azure DevOps;
  • $Organization = Organization URL used on REST API;

2. Projects List = use this command to list all projects on the Azure DevOps organization.

$uriProject = $UriOrganization + "_apis/projects/"
$ProjectsResult = Invoke-RestMethod -Uri $uriProject -Method get -Headers $AzureDevOpsAuthenicationHeader
Foreach ($project in $ProjectsResult.value)
{
Write-Host $project.name
}

3. Get Teams = use this command to list all teams from each project on Azure DevOps.

$uriTeams = $UriOrganization + "_apis/projects/$($project.id)/teams"    $TeamsResult = Invoke-RestMethod -Uri $uriTeams -Method get -Headers $AzureDevOpsAuthenicationHeader    
Foreach ($team in $TeamsResult.value)
{
Write-Host $team.name
}

4. Iterations List = use this command to list all iterations from each team on Azure DevOps.

$uriSprintsTeam = $UriOrganization + "$($project.id)/$($team.id)/_apis/work/teamsettings/iterations"        $SprintsTeamResult = Invoke-RestMethod -Uri $uriSprintsTeam -Method get -Headers $AzureDevOpsAuthenicationHeader        
Foreach ($sprintteam in $SprintsTeamResult.value)
{
Write-Host $sprintteam.attributes.startDate
Write-Host $sprintteam.attributes.finishDate
}

5. Get Capacities = use this command to list all members from each iterations of Azure DevOps.

$uriCapacities = $UriOrganization + "$($project.id)/$($team.id)/_apis/work/teamsettings/iterations/$($sprintteam.id)/capacities"                
$CapacitiesResult = Invoke-RestMethod -Uri $uriCapacities -Method get -Headers $AzureDevOpsAuthenicationHeader
Foreach ($capacity in $CapacitiesResult.value)
{
Write-Host $capacity.teamMember.displayName
}

At the end of the script, I just created a JSON that contains all information about project, team, sprint, member, and capacity. The example below show these information:

{
"UserName": "Vinicius Moura",
"UserNameHour": 5.0,
"SprintStartDate": "2020-10-19",
"SprintName": "Sprint 2",
"SprintFinishDate": "2020-10-30",
"ProjectName": "Capacity",
"TeamName": "Team B",
"UserNameActivity": "Documentation"
}

After that, I connected this JSON on PowerBI and I put the information on a calendar. Using my user as an example, it is clear that I am allocated to two sprints at the same time.

  1. Azure DevOps capacities:

2. PowerBI:

The PowerBI report is also available on GitHub repository. Please download the script and report and send me feedbacks!

--

--