If your a decent sized organization you might have Azure DevOps with loads of different teams using DevOps. How do you provide governance on top of what teams are doing?

This week I was looking at our organization and we had 80 odd projects in DevOps. A lot of them are just used for the work item tracking features for specific projects. Others are used longer term for code repos. I realized that there were a lot more code repos across the organization than id noticed before so I wanted to just get a quick view on that. Below is a quick script that used the azure devops cli and will list the projects you have and how many repos you have in each one.

Im sure someone out there might find this a handy start for something.


$devOpsOrg = "My-Project"
$devOpsRootUrl = "https://dev.azure.com/" + $devOpsOrg

az devops configure --defaults organization=$devOpsRootUrl

$projectList = az devops project list | ConvertFrom-Json
foreach($project in $projectList.Value){
    $devOpsProjectName = $project.name

    Write-Host "DevOps Project"
    Write-Host "=============="
    Write-Host "`t`t" + $devOpsProjectName
    Write-Host "`t`t" + $project.url
    
    $repoList = az repos list --organization $devOpsRootUrl --project $devOpsProjectName | ConvertFrom-Json
    foreach($repo in $repoList){
        $devOpsRepoName = $repo.name

        Write-Host "`t`t`t" + $devOpsRepoName
    }
    Write-Host ""
    Write-Host ""
    Write-Host ""
}

 

Buy Me A Coffee