> ## Documentation Index
> Fetch the complete documentation index at: https://docs.augmentcode.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Integrate Azure DevOps Cloud

## Introduction

In this document we’ll configure the native Cosmos integration with Azure DevOps Cloud (aka ADO), and learn how to:

1. Get ADO to push events to Cosmos via webhooks
2. Configure a Cosmos environment that git clones/fetches from ADO repo(s)
3. Get Cosmos to automatically review and comment on a PR when created
4. Deploy a PR Author and PR Deep Code Reviewer experts using the Cosmos Advisor

For 4, below is the flow that will be followed by the Cosmos PR Deep Code Reviewer expert:

```mermaid theme={null}
sequenceDiagram
	autonumber
	participant ADO as ADO
	participant A as Augment Code | Cosmos
	ADO->>A: Webhook: Pull Request created (PR payload)
	A->>A: Start Expert (spawn/run expert agent)
	A->>A: Expert analyzes PR (diff + context)
	A->>ADO: POST PR comment
	ADO-->>A: 201 Created (comment posted)
```

The native ADO integration also supports Work Items, so you can later deploy Ticket Triager and Dispatcher experts to manage your backlog of tickets.

## Prerequisites

To configure the one-time connectivity between Cosmos and ADO:

* you must be a Augment admin
* you must either
  * have permissions to create a dedicated EntraID service account user with permissions to access ADO projects (with Project Collection Administrator role)
  * or have permissions to create a dedicated ADO service account user with permissions to access ADO projects (with Project Collection Administrator role)

## Step 1 - Configure the native ADO integration

As a Augment admin, go to [cosmos.augmentcode.com](http://cosmos.augmentcode.com/) > Settings > Integrations ([https://cosmos.augmentcode.com/integrations](https://cosmos.augmentcode.com/integrations)) and next to Azure DevOps click on Configure:

<img src="https://mintcdn.com/augment-mtje7p526w/XXVowgznyzYE_wgh/images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-01.png?fit=max&auto=format&n=XXVowgznyzYE_wgh&q=85&s=cb1abc1d50f4f60c1853d3c6f8a4257a" alt="" width="865" height="391" data-path="images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-01.png" />

Note: if you don’t see the ADO option in your tenant, reach out to your Augment Solution Architect or send Augment a note: [https://www.augmentcode.com/contact](https://www.augmentcode.com/contact)

You should land on that page:

<img src="https://mintcdn.com/augment-mtje7p526w/XXVowgznyzYE_wgh/images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-02.png?fit=max&auto=format&n=XXVowgznyzYE_wgh&q=85&s=3f7aff21a8c8877ea1ff1b6a487c9ca5" alt="" width="870" height="690" data-path="images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-02.png" />

2 options:

1. EntraID OAuth route
2. ADO PAT token route

### Option1: Connecting to ADO via EntraID OAuth

Let’s create a new EntraID user with Project Collection Administrator role on the corresponding ADO projects.

Go to your EntraID admin portal [https://entra.microsoft.com/](https://entra.microsoft.com/) > Entra ID > Users > New user > Create new user:

* UPN: ex: [augmentcode@mycompany.com](mailto:augmentcode@mycompany.com)
* Display name: Augment Code

Click on Review + create

Now go to each ADO organization (`https://dev.azure.com/<ORGANIZATION-ID>/`) > Organization Settings > Users > Add users. In the users field type in the name of your EntraID service account user and select the matching user, select Access Level = Basic, select your projects and Azure DevOps Groups = Project Contributors. You should see this:

<img src="https://mintcdn.com/augment-mtje7p526w/XXVowgznyzYE_wgh/images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-03.png?fit=max&auto=format&n=XXVowgznyzYE_wgh&q=85&s=61f6a9e0690abb41f3ebf878c63b189f" alt="" width="1120" height="467" data-path="images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-03.png" />

<img src="https://mintcdn.com/augment-mtje7p526w/XXVowgznyzYE_wgh/images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-04.png?fit=max&auto=format&n=XXVowgznyzYE_wgh&q=85&s=500c6c217273587e5ccfcba0a6e99380" alt="" width="1128" height="472" data-path="images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-04.png" />

Then navigate to Organization Settings > Permissions, you should see this:

<img src="https://mintcdn.com/augment-mtje7p526w/XXVowgznyzYE_wgh/images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-05.png?fit=max&auto=format&n=XXVowgznyzYE_wgh&q=85&s=384a379237574497c0b27967ae5618be" alt="" width="1132" height="912" data-path="images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-05.png" />

Click on Project Collection Administrators > Members tab > Add > type in the name of your EntraID service account user and select the matching user, then click on Save

<img src="https://mintcdn.com/augment-mtje7p526w/XXVowgznyzYE_wgh/images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-06.png?fit=max&auto=format&n=XXVowgznyzYE_wgh&q=85&s=d80bfcc17b19ef45fc6afc1961f5ff9b" alt="" width="1131" height="627" data-path="images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-06.png" />

You should see this:

<img src="https://mintcdn.com/augment-mtje7p526w/XXVowgznyzYE_wgh/images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-07.png?fit=max&auto=format&n=XXVowgznyzYE_wgh&q=85&s=2da4ef4b3fe252e8b24b39286fe0769a" alt="" width="1134" height="616" data-path="images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-07.png" />

At this point, your EntraID service account user should be able to access your ADO project. Let’s test this out: open a new browser session (or new incognito window) > sign in using your EntraID service account user, and navigate to your ADO organization (`https://dev.azure.com/<ORGANIZATION-ID>/`). You should see this:

<img src="https://mintcdn.com/augment-mtje7p526w/XXVowgznyzYE_wgh/images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-08.png?fit=max&auto=format&n=XXVowgznyzYE_wgh&q=85&s=25b4e362a9c2c8f139eeccc2dac728aa" alt="" width="1712" height="610" data-path="images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-08.png" />

In that same browser session, re-authenticate to Cosmos as an admin and go to Settings > Integrations > Azure DevOps > and click on Connect with Entra OAuth:

<img src="https://mintcdn.com/augment-mtje7p526w/XXVowgznyzYE_wgh/images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-09.png?fit=max&auto=format&n=XXVowgznyzYE_wgh&q=85&s=c34d420a034c28e7e1b903b6a8c499f3" alt="" width="1686" height="1664" data-path="images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-09.png" />

You should see this OAuth consent screen, click on Accept:

<img src="https://mintcdn.com/augment-mtje7p526w/XXVowgznyzYE_wgh/images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-10.png?fit=max&auto=format&n=XXVowgznyzYE_wgh&q=85&s=20699957d34760c4138193ac396d0f93" alt="" width="850" height="1256" data-path="images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-10.png" />

You should then be redirected to Cosmos with the list of Repositories your service account has access to:

<img src="https://mintcdn.com/augment-mtje7p526w/XXVowgznyzYE_wgh/images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-11.png?fit=max&auto=format&n=XXVowgznyzYE_wgh&q=85&s=2a2b118a604c8572f7698299a060afcb" alt="" width="1692" height="1250" data-path="images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-11.png" />

### Option2: Connecting to ADO via Personal access token

For this option, you will complete the same steps as in Option1 to create a new dedicated EntraID service account user and grant it access to the corresponding ADO organization and projects, but instead of connecting ADO to Cosmos via OAuth, you’ll leverage a ADO PAT token.

Make sure your service account user can access your ADO organization, you should see this when navigating to `https://dev.azure.com/<ORGANIZATION-ID>/`:

<img src="https://mintcdn.com/augment-mtje7p526w/XXVowgznyzYE_wgh/images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-12.png?fit=max&auto=format&n=XXVowgznyzYE_wgh&q=85&s=5d97557e3553296ed39b8d3daabcbc7d" alt="" width="1698" height="644" data-path="images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-12.png" />

Click on the wheel icon top right > Personal access tokens

<img src="https://mintcdn.com/augment-mtje7p526w/XXVowgznyzYE_wgh/images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-13.png?fit=max&auto=format&n=XXVowgznyzYE_wgh&q=85&s=89bbe63b58231a4e97cb780eb8dcc2ce" alt="" width="1702" height="770" data-path="images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-13.png" />

You should see this:

<img src="https://mintcdn.com/augment-mtje7p526w/XXVowgznyzYE_wgh/images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-14.png?fit=max&auto=format&n=XXVowgznyzYE_wgh&q=85&s=985c8eff49e92aa8df30c8c1d6e0d302" alt="" width="1710" height="1172" data-path="images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-14.png" />

Click on New Token:

* Name: Token01
* Organization: a specific organization or `All accessible organizations` (recommended if using multiple organizations)
* Expiration: pick the date most far out
* Scopes: `Custom defined`, then select
  * `Work Items (Read & Write)`
  * `Code (Read & Write)`

You should see this:

<img src="https://mintcdn.com/augment-mtje7p526w/XXVowgznyzYE_wgh/images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-15.png?fit=max&auto=format&n=XXVowgznyzYE_wgh&q=85&s=84f0d1d57dc14bb15d1743d824c13523" alt="" width="1348" height="1624" data-path="images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-15.png" />

Click on Create, you’ll then be presented with a PAT token:

<img src="https://mintcdn.com/augment-mtje7p526w/XXVowgznyzYE_wgh/images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-16.png?fit=max&auto=format&n=XXVowgznyzYE_wgh&q=85&s=154daacdea10d67f8ed709b07e2366c7" alt="" width="383" height="248" data-path="images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-16.png" />

Copy this PAT token then go back to Cosmos as an admin and go to Settings > Integrations > Azure DevOps > expand the section Use a personal access token instead

<img src="https://mintcdn.com/augment-mtje7p526w/XXVowgznyzYE_wgh/images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-17.png?fit=max&auto=format&n=XXVowgznyzYE_wgh&q=85&s=95abfdd0472e0a712c0710a38e608d03" alt="" width="1686" height="1664" data-path="images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-17.png" />

Enter your ADO organization name, PAT token, and click on Connect bot token:

<img src="https://mintcdn.com/augment-mtje7p526w/XXVowgznyzYE_wgh/images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-18.png?fit=max&auto=format&n=XXVowgznyzYE_wgh&q=85&s=eb85e5005096efb8458e9cfac7df5981" alt="" width="1046" height="502" data-path="images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-18.png" />

You should then see the list of Repositories your service account has access to:

<img src="https://mintcdn.com/augment-mtje7p526w/XXVowgznyzYE_wgh/images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-19.png?fit=max&auto=format&n=XXVowgznyzYE_wgh&q=85&s=4588860a28e4a609dfe57238ae990c40" alt="" width="2026" height="1256" data-path="images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-19.png" />

## Step 2 - Create a cloud environment

Let’s create a cloud environment with those ADO repos:

Go to Cosmos Settings > Environments ([https://cosmos.augmentcode.com/environments](https://cosmos.augmentcode.com/environments)) > top right Create an environment > Cloud machine

<img src="https://mintcdn.com/augment-mtje7p526w/XXVowgznyzYE_wgh/images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-20.png?fit=max&auto=format&n=XXVowgznyzYE_wgh&q=85&s=7e448115f608508d1707507b7989eb3a" alt="" width="719" height="85" data-path="images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-20.png" />

Configure your environment:

* Name: ex: ADO ecomm-stack
* Image: ex: keep the Cosmos default base image
* Repositories: select your ADO repos
* Refresh: toggle on
* Spaces: keep the default space
* Click on Create Environment

<img src="https://mintcdn.com/augment-mtje7p526w/XXVowgznyzYE_wgh/images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-21.png?fit=max&auto=format&n=XXVowgznyzYE_wgh&q=85&s=f9c92f2f6a7ff2f6e163d2d8e77b4fb6" alt="" width="1024" height="846" data-path="images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-21.png" />

Cosmos will create the cloud environment, git clone your repos and keep them up to date:

<img src="https://mintcdn.com/augment-mtje7p526w/XXVowgznyzYE_wgh/images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-22.png?fit=max&auto=format&n=XXVowgznyzYE_wgh&q=85&s=247beb45a27faf44675b515f1a69e172" alt="" width="338" height="170" data-path="images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-22.png" />

<img src="https://mintcdn.com/augment-mtje7p526w/XXVowgznyzYE_wgh/images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-23.png?fit=max&auto=format&n=XXVowgznyzYE_wgh&q=85&s=fbd6dda57c365cf88c6578f3c7bf8bb2" alt="" width="686" height="242" data-path="images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-23.png" />

Click on Done

You’ll see your new environment in your “Mine” tab:

<img src="https://mintcdn.com/augment-mtje7p526w/XXVowgznyzYE_wgh/images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-24.png?fit=max&auto=format&n=XXVowgznyzYE_wgh&q=85&s=e9e52b60403cc5166a7de22294043054" alt="" width="1470" height="688" data-path="images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-24.png" />

Now let’s do a quick test and create a session with that env:

In the left sidebar click on ‘Back to app’ > New session ([https://cosmos.augmentcode.com/home](https://cosmos.augmentcode.com/home)) > bottom left of the prompt select your cloud env, then click on Integrations and verify that ADO is selected, then send this prompt `What are those repos about?`

<img src="https://mintcdn.com/augment-mtje7p526w/XXVowgznyzYE_wgh/images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-25.png?fit=max&auto=format&n=XXVowgznyzYE_wgh&q=85&s=e084c99d432cc25cad17163d9fd98a02" alt="" width="1260" height="1248" data-path="images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-25.png" />

That’ll start a session. Open the right sidebar by clicking on the icon top right, then note that Expert = Not set, Integrations include Azure DevOps App, your selected env and corresponding repos are visible:

<img src="https://mintcdn.com/augment-mtje7p526w/XXVowgznyzYE_wgh/images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-26.png?fit=max&auto=format&n=XXVowgznyzYE_wgh&q=85&s=c34147a41076ee617dd993291799577c" alt="" width="1970" height="1706" data-path="images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-26.png" />

From that session prompt `List the last open PRs on those repos`, Cosmos should return a list that looks like this:

<img src="https://mintcdn.com/augment-mtje7p526w/XXVowgznyzYE_wgh/images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-27.png?fit=max&auto=format&n=XXVowgznyzYE_wgh&q=85&s=9b196d50539e893308263861160c4b03" alt="" width="1972" height="1710" data-path="images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-27.png" />

Lastly, from that session prompt `List the most recent work items across those ADO orgs`, Cosmos should return a list that looks like this:

<img src="https://mintcdn.com/augment-mtje7p526w/XXVowgznyzYE_wgh/images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-28.png?fit=max&auto=format&n=XXVowgznyzYE_wgh&q=85&s=b5f34f353e33daa13b51173fd7d613c8" alt="" width="1952" height="1700" data-path="images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-28.png" />

Your ADO integration and your cloud env are ready! You can now leverage the Cosmos Advisor expert to create your ADO-specific experts.

## Step 3 - Create a PR Deep Code Reviewer expert

Cosmos has a large knowledge base and greatly assists with creating new experts.<br />A common expert you’d create for your ADO repos is the “PR Deep Code Reviewer”, whose job will be to auto react to PRs being created and auto review them. Whenever you need to create new experts go ask the Cosmos Advisor.

Go to New session ([https://cosmos.augmentcode.com/home](https://cosmos.augmentcode.com/home)) > select the ‘Cosmos Advisor’ expert, make sure the ADO integration is selected and prompt with `Create a PR author, a PR risk analyzer, a PR deep reviewer. The PR review should start whenever a PR gets created. Those experts should reuse the ADO ecomm-stack env of this session, and use the Azure DevOps integration`:

<img src="https://mintcdn.com/augment-mtje7p526w/XXVowgznyzYE_wgh/images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-29.png?fit=max&auto=format&n=XXVowgznyzYE_wgh&q=85&s=15917f1f281320b5af9b9a4d526f3fef" alt="" width="1254" height="1258" data-path="images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-29.png" />

The Cosmos Advisor may ask you to clarify what experts to deploy, it may recommend to deploy additional experts (ex: helper experts), and if an integration is missing it’ll guide you to add it. If you are deploying experts across different types of repos (ex: Github, Gitlab, ADO), don’t hesitate to prompt Advisor with `make sure all those experts have the (Azure DevOps) suffix` so you can quickly spot the ADO-specific experts vs the Github ones etc. Ultimately you should see this at the end of your session:

<img src="https://mintcdn.com/augment-mtje7p526w/XXVowgznyzYE_wgh/images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-30.png?fit=max&auto=format&n=XXVowgznyzYE_wgh&q=85&s=541fb6611753695e4221b092ea51a178" alt="" width="1078" height="978" data-path="images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-30.png" />

<img src="https://mintcdn.com/augment-mtje7p526w/XXVowgznyzYE_wgh/images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-31.png?fit=max&auto=format&n=XXVowgznyzYE_wgh&q=85&s=baa8e887cdf0c4cd3336c32aad34b878" alt="" width="1024" height="588" data-path="images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-31.png" />

Let’s see where the experts are created: go to Cosmos Settings > Experts ([https://cosmos.augmentcode.com/experts](https://cosmos.augmentcode.com/experts)) > filter on expert name containing “Azure DevOps”:

<img src="https://mintcdn.com/augment-mtje7p526w/XXVowgznyzYE_wgh/images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-32.png?fit=max&auto=format&n=XXVowgznyzYE_wgh&q=85&s=5bfcde726639dcfb8f3af4782a0ed98e" alt="" width="1972" height="942" data-path="images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-32.png" />

Cosmos Advisor configured some experts to react to ADO events, you can see those configured in Cosmos settings > Automations ([https://cosmos.augmentcode.com/automations](https://cosmos.augmentcode.com/automations))

<img src="https://mintcdn.com/augment-mtje7p526w/XXVowgznyzYE_wgh/images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-33.png?fit=max&auto=format&n=XXVowgznyzYE_wgh&q=85&s=33f58c8fafb72ce92b2f5e93930a6370" alt="" width="1978" height="746" data-path="images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-33.png" />

If you expand the Deep Code Reviewer (Azure DevOps) you’ll see its triggers:

<img src="https://mintcdn.com/augment-mtje7p526w/XXVowgznyzYE_wgh/images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-34.png?fit=max&auto=format&n=XXVowgznyzYE_wgh&q=85&s=1a74c5e1fd207ca2f9f95bb9fa68476e" alt="" width="1568" height="404" data-path="images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-34.png" />

Note: the current native ADO integration automatically manages ADO PR webhooks, and soon Work Item webhooks will also be managed

## Step 4 - Create a new PR and observe your experts at work

Create a new session ([https://cosmos.augmentcode.com/home](https://cosmos.augmentcode.com/home)), implement a simple change ex: prompt with `add a hello world banner on top of the web app, then create a PR in ready to review state`:

<img src="https://mintcdn.com/augment-mtje7p526w/XXVowgznyzYE_wgh/images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-35.png?fit=max&auto=format&n=XXVowgznyzYE_wgh&q=85&s=4f784ce482e99b06e75558b25679a22b" alt="" width="1984" height="1702" data-path="images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-35.png" />

Then open your PR, you’ll see the PR Deep Code Reviewer expert commenting on the PR:

<img src="https://mintcdn.com/augment-mtje7p526w/XXVowgznyzYE_wgh/images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-36.png?fit=max&auto=format&n=XXVowgznyzYE_wgh&q=85&s=a641f879cdc4c7df968ccc477c4ad171" alt="" width="904" height="882" data-path="images/cosmos-integrations/azure-devops-cloud/azure-devops-cloud-36.png" />

Congratulations, you’ve configured the native ADO integration and your first PR experts!
