Skip to content

Git hosts

Azure DevOps

Connect Azure DevOps with a personal access token. Reviews, checks and mentions work as they do on GitHub.

Codebot works on Azure DevOps through a personal access token (PAT). Everything Codebot posts appears as the token’s user, so we recommend a dedicated account.

Create an account for Codebot

Create a user in your Azure DevOps organization, named for example TryCodeBot, and give it access to the projects you want reviewed. Reviews, votes and comments will come from this user, and people mention it to ask for a review.

You can use your own account to try Codebot out, but then reviews show up as you.

Create a token

Signed in as that user, create a personal access token with these scopes:

ScopeWhy
Code (Read & write)Clone repositories, post reviews and comments, push the agent’s changes.
Code (Status)Report each review as a pull request status.
Project and Team (Read)List the projects and repositories to choose from.
Service Hooks (Read & write)Subscribe to pull request events so reviews start right away.

Connect

Add the connection

Go to Settings → Integrations, click Connect next to Azure DevOps, and enter your organization name and the token.

Turn on code review

Open Code review → Add repository and pick a repository. Codebot subscribes to its pull request events.

Optional: require the status

Add a branch policy that requires the codebot/Code review status. See Checks and merge gate.

Service hooks or polling

Codebot hears about pull requests through service hooks. Creating them needs Edit subscriptions on the project, which project administrators have.

If the token’s user can’t create hooks, Codebot doesn’t fail: it polls the repository every two minutes instead, and the repository shows Polling on the Code review page. Polling picks up new pull requests, new commits and drafts marked ready. Review commands, mentions and votes need service hooks.

To move from polling to hooks, give the user Edit subscriptions on the project (or make it a project administrator), then use Sync repositories from the ⋯ menu in Settings → Integrations → Azure DevOps.

How reviews look on Azure DevOps

  • Findings are active comment threads on the file and line.
  • Every comment ends with Posted by Codebot, since it’s posted as the token’s user.
  • Approve is a vote of Approved (10); request changes is Waiting for author (-5). A plain comment doesn’t vote.
  • The review is reported as a pull request status, codebot/Code review.

Review command and mentions

Mention the token’s user in a pull request comment:

  • @TryCodeBot review runs a review.
  • @TryCodeBot with anything else hands the request to the agent.

Anyone who can comment on the pull request can use them. Codebot likes your comment when it starts, and replies when it can’t.

Manage the connection

The ⋯ menu in Settings → Integrations → Azure DevOps lets you:

  • Sync repositories: refresh the repository list and re-create service hooks;
  • Replace token: swap in a new PAT before the old one expires;
  • Disconnect: remove the service hooks and the connection.

When the token expires or is revoked, Codebot pauses that connection and stops reviewing. Replace the token to resume.