Skip to content

Instantly share code, notes, and snippets.

@hawjeh
Created June 17, 2021 02:26
Show Gist options
  • Save hawjeh/ea156a5a72e52ab316059d45bbf77125 to your computer and use it in GitHub Desktop.
Save hawjeh/ea156a5a72e52ab316059d45bbf77125 to your computer and use it in GitHub Desktop.
Batch Remove Azure DevOps Tags
try {
$cred = Get-Credential
$list = Invoke-RestMethod -Uri "https://<domain>/<Organization>/<Project>/_apis/git/repositories/<Repository>/refs?filter=tags/&api-version=6.0-preview.1" -Credential $cred
foreach ($l in $list.value)
{
Invoke-WebRequest -Uri "https://<domain>/<Organization>/<Project>/_apis/git/repositories/<Repository>/refs?api-version=6.0" -Credential $cred -ContentType "application/json" -Method POST -Body "[{'name':'$($l.name)','newObjectId':'0000000000000000000000000000000000000000','oldObjectId':'$($l.objectId)'}]"
}
Write-Host "End of Work"
cmd /c pause | out-null
}
catch {
throw "ERROR"
cmd /c pause | out-null
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment