Whether you’re a developer, a project manager, or an IT professional, this guide is just for you. We’ll explore several methods, discuss their pros and cons, and ensure you walk away with a robust understanding of how to get Azure devops project id.
How to get Project ID in Azure DevOps
Method 1: Using the Azure DevOps REST API – For the Power User
For those who frequently work with automation, scripting, or custom integrations, using the Azure DevOps REST API to fetch the Project ID is an incredibly powerful and efficient method. This is where you truly harness the programmatic capabilities of Azure DevOps.
To use the API, you’ll need a Personal Access Token (PAT) with sufficient permissions (at least “Project and Team (Read)” scope) or an OAuth 2.0 authorization flow. For simplicity, this tutorial focuses on using a PAT.
Prerequisites:
- Personal Access Token (PAT): Create a PAT in Azure DevOps (User settings -> Personal access tokens). Ensure it has the “Project and Team (Read)” scope.
- HTTP Client: Tools like Postman, Insomnia,
curl, or even a simple script usingInvoke-RestMethod(PowerShell) orrequests(Python) can be used.
API Endpoint:
The core API endpoint to list projects within an organization is:
GET https://dev.azure.com/{organization}/_apis/projects?api-version=7.1-preview.4
Example
https://dev.azure.com/fewlines4biju/_apis/projects/TeamTsinfo?api-version=7.1Copy and paste this url in your browser. See the screenshot below, we got the expected output, and the project ID is highlighted in red.

Step-by-step with curl (command-line tool):
- Obtain your PAT: Let’s say your PAT is
your_personal_access_token. - Construct the
curlcommand:Bashcurl -u :{your_personal_access_token} \ https://dev.azure.com/{your_organization_name}/_apis/projects?api-version=7.1-preview.4 \ -H "Accept: application/json"- Replace
{your_personal_access_token}with your actual PAT. - Replace
{your_organization_name}with your Azure DevOps organization’s name (e.g.,TechSolutionsUSA). - The
-uflag with:{PAT}tellscurlto use the PAT for basic authentication without a username (the colon before the PAT is crucial).
- Replace
- Execute the command: Run this command in your terminal.
- Parse the JSON Response: The API will return a JSON array of all projects within your organization. Each project object will contain its name, description, and, crucially, its
id(which is the Project ID GUID). - Example JSON Snippet (simplified):JSON
{ "count": 2, "value": [ { "id": "a1b2c3d4-e5f6-7890-1234-567890abcdef", "name": "NorthwindTraders", "description": "E-commerce solutions for a global market", "url": "https://dev.azure.com/TechSolutionsUSA/_apis/projects/a1b2c3d4-e5f6-7890-1234-567890abcdef", "state": "wellFormed", "revision": 123 }, { "id": "f0e9d8c7-b6a5-4321-fedc-ba9876543210", "name": "ProjectPhoenix", "description": "Next-gen internal tools development", "url": "https://dev.azure.com/TechSolutionsUSA/_apis/projects/f0e9d8c7-b6a5-4321-fedc-ba9876543210", "state": "wellFormed", "revision": 456 } ] }From this response, you can easily identify theidfield corresponding to your project’sname.
Pros:
- Automation-Friendly: Ideal for scripts, CI/CD pipelines, and integrating with other systems.
- Programmatic Access: Allows for dynamic retrieval of Project IDs without manual intervention.
- Comprehensive: Can retrieve details for all projects in an organization.
Cons:
- Requires Setup: Needs a PAT and familiarity with API calls or scripting.
- Learning Curve: Steeper learning curve for beginners compared to UI methods.
- Security Consideration: Managing PATs requires careful attention to security.
Method 2: Azure DevOps CLI
For those who love working in the terminal and managing Azure resources via the command line, the Azure DevOps CLI extension is a powerful tool. It provides a consistent and efficient way to interact with your Azure DevOps organizations and projects.
Prerequisites:
- Azure CLI Installed: You need the Azure Command-Line Interface installed on your machine.
- Azure DevOps Extension: Install the Azure DevOps extension for the Azure CLI. If you haven’t already, run:
az extension add --name azure-devops - Logged In: Ensure you are logged into Azure CLI with an account that has access to your Azure DevOps organization.
az login - Set Default Organization (Optional but Recommended): To simplify commands, set your default Azure DevOps organization:
az devops configure --defaults organization=https://dev.azure.com/{your_organization_name}
Step-by-step to get Project ID:
List all Projects under a specific Organization
az devops project list --org https://dev.azure.com/YourOrgName --output tableExample
az devops project list --org https://dev.azure.com/fewlines4biju --output tableAfter executing the above query, I got the expected output as shown in the screenshot below

Filtering for a specific project:
You can also filter the output using JMESPath queries directly within the CLI to get just the ID for a known project name:
az devops project show --project "TeamTsinfo" --org https://dev.azure.com/fewlines4biju --query idAfter executing the above query, I got the expected output as shown in screenshot below

- List Projects: Use the
az devops project listcommand to get a list of all projects in your configured organization.Bashaz devops project list --output json- The
--output jsonflag will give you a JSON output, which is easy to parse. You can also use--output tablefor a more human-readable format, but it might not show the GUID explicitly.
- The
- Identify the Project ID: In the JSON output, each project will have an
idfield. Locate the project you’re interested in by itsnameand then copy its correspondingid. - Example Output Snippet (simplified):JSON
[ { "abfUri": "vstfs:///Classification/TeamProject/a1b2c3d4-e5f6-7890-1234-567890abcdef", "description": "E-commerce