Skip to content

Instantly share code, notes, and snippets.

@mdailey77
Created August 13, 2022 20:15
Show Gist options
  • Save mdailey77/40cd4b6a08e2eb075f6b18185c8b94ac to your computer and use it in GitHub Desktop.
Save mdailey77/40cd4b6a08e2eb075f6b18185c8b94ac to your computer and use it in GitHub Desktop.
Gets information on the current project iteration in Azure Boards
<# Azure DevOps REST API #>
$url = 'https://dev.azure.com/{organization_name}/{project_name}/_apis/work/teamsettings/iterations?$timeframe=current&api-version=7.1-preview.1'
$Token = '{Azure DevOps PAT}'
if ($Token -eq "") {
Write-Host 'PAT not set'
exit 1
}
$AzureAuthHeader = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f "", $Token)))
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Authorization", ("Basic {0}" -f $AzureAuthHeader))
$headers.Add("Content-Type", "application/json")
$response = Invoke-RestMethod -Uri $url -Method GET -Headers $headers
$iterations = $response.value
foreach ($i in $iterations){
Write-Host $i.name
Write-Host $i.attributes.startDate
Write-Host $i.attributes.finishDate
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment