Mudit
Mudit

Reputation: 71

How to get the count of projects, repositories and teams created in Azure DevOps?

How to get the list of projects, repositories and teams created in Azure DevOps. Also the administrators, contributors and pull request approver's list. I have seen the API mentioned in Azure docs but it provides the info in json format which has a lot of info and is really difficult to pull out the project and repository name. How can I get that data in excel or word document?

Upvotes: 4

Views: 5548

Answers (4)

Abhishek
Abhishek

Reputation: 37

The best way to retrieve the list of Project and team is using the OData feed. One can use excel or Power bi to retrieve the data. I am attaching how to retrieve the list of team and Project from Azure DevOps. https://learn.microsoft.com/en-us/azure/devops/report/powerbi/access-analytics-power-bi?view=azure-devops

Upvotes: 0

salih
salih

Reputation: 148

Best option looks like Rest APIs which returns json, but I am afraid there is no easy way to export them to excel or word.

For people who are searching what exactly are the Rest API endpoints to fetch them, here are the details;

How to get git repositories?

You can follow following steps to see the count of repositories

  1. Login to Azure DevOps
  2. Open one of following links by modifying your organization and project name

https://dev.azure.com/{ORGANIZATION_NAME}/{PROJECT_NAME}/_apis/git/repositories/ https://dev.azure.com/{ORGANIZATION_NAME}/{PROJECT_ID}/_apis/git/repositories/

  1. Scroll to the end of the json response and you should see the count at the end of the page Sample Api Response

How to get projects?

Follow step 1 and then open the link below

https://dev.azure.com/{ORGANIZATION_NAME}/_apis/projects

How to get teams?

Follow step 1 and then open the link below

https://dev.azure.com/{ORGANIZATION_NAME}/_apis/teams

How to find the project Id?

In Chrome, open the developer tools, open Azure DevOps and navigate to your project then you should see following calls which will give you the project id Call from Chrome Developer Tools

Upvotes: 4

Tristik
Tristik

Reputation: 47

list all repos and count the lines assuming you have access to.

# get repo details
$repo_list = az devops project list --query 'value[].name' -o tsv | % { az repos list --project $_ -o tsv} 
# count the output lines
$repo_list = az devops project list --query 'value[].name' -o tsv | % { az repos list --project $_ -o tsv} | wc -l```
note: ran this in powershell with a computer with git bash. the wc command is not a powershell command normally

Upvotes: 3

Leo Liu
Leo Liu

Reputation: 76928

How to get the count of projects, repositories and teams created in Azure DevOps?

I am afraid there is no such out of box method to get that data in excel or word document at this moment. We could not get the list of projects,repositories via queries and export it to the excel or word document.

To achieve this, you can accept the advise of Shayki Abramczyk, using the Rest API.

After get the response in json format, then parse the json file with Powershell or other scripts, like:

PS Script Get All Team Projects Listed as HTML–TFS/VSTS

Besides, when we parse the josn file, we even could export the data to the csv file:

Ticket: How to export data to CSV in PowerShell?

Hope this helps.

Upvotes: 0

Related Questions