Introduction
In this document we’ll configure the native Cosmos integration with Azure DevOps Cloud (aka ADO), and learn how to:- Get ADO to push events to Cosmos via webhooks
- Configure a Cosmos environment that git clones/fetches from ADO repo(s)
- Get Cosmos to automatically review and comment on a PR when created
- Deploy a PR Author and PR Deep Code Reviewer experts using the Cosmos Advisor
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 > Settings > Integrations (https://cosmos.augmentcode.com/integrations) and next to Azure DevOps click on Configure:

- EntraID OAuth route
- 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/ > Entra ID > Users > New user > Create new user:- UPN: ex: augmentcode@mycompany.com
- Display name: Augment Code
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:





https://dev.azure.com/<ORGANIZATION-ID>/). You should see this:




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 tohttps://dev.azure.com/<ORGANIZATION-ID>/:



- 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 selectWork Items (Read & Write)Code (Read & Write)





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) > top right Create an environment > Cloud machine
- 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




What are those repos about?


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

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

Step 3 - Create a PR Deep Code Reviewer expert
Cosmos has a large knowledge base and greatly assists with creating new experts.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) > 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:

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:





Step 4 - Create a new PR and observe your experts at work
Create a new session (https://cosmos.augmentcode.com/home), implement a simple change ex: prompt withadd a hello world banner on top of the web app, then create a PR in ready to review state:

