Azure Repos logo If you want to list all the Git repositories for all projects in an Azure DevOps organisation, this script will return all the remote URLs.

See Personal access tokens for instructions on how to create the personal access token.

param (
    [string] $organisation,
    [string] $personalAccessToken

$base64AuthInfo= [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$($personalAccessToken)"))
$headers = @{Authorization=("Basic {0}" -f $base64AuthInfo)}

$result = Invoke-RestMethod -Uri "$organisation/_apis/projects?api-version=6.0" -Method Get -Headers $headers

$projectNames = $

$projectNames | ForEach-Object {
    $project = $_

    $result = Invoke-RestMethod -Uri "$organisation/$project/_apis/git/repositories?api-version=6.0" -Method Get -Headers $headers

} | Sort-Object

It makes use of the Repositories - List REST API, so you could ask for any of the other properties instead of or in addition to remoteUrl as well.