Forum Discussion
chamidu_sumanasekara
Nov 13, 2024Copper Contributor
Azure GIT - Get repository list by user PAT
Hi We are looking for an API or a workaround to get all the repositories by the PAT ex: assume there is a user whose PAT has access to two organizations Is there an API or a workaround to fetch ...
balasubramanim
Nov 14, 2024Iron Contributor
chamidu_sumanasekara
To list all repositories accessible by a PAT across multiple organizations:
1. List Organizations: Manually specify the organizations (Azure DevOps doesn’t provide an API to list them).
2. Get Projects in Each Organization: For each organization, use
GET https://dev.azure.com/{organization}/_apis/projects?api-version=7.1-preview.4
3.Get Repositories in Each Project: For each project, use
GET https://dev.azure.com/{organization}/{project}/_apis/git/repositories?api-version=7.1-preview.1
4. Automate with a Script: Loop through organizations and projects to collect repositories.
This approach helps you fetch all accessible repositories with a PAT across specified organizations