Skip to main content
Only administrators can set up this integration. Before you begin, confirm that you are a CodeRabbit organization administrator and have either Project Administrator or Project Collection Administrator permissions in Azure DevOps. If you don’t have both roles, ask the appropriate administrators to complete the setup. Select the authentication tab that matches your setup for the full requirements.
CodeRabbit enhances your Azure DevOps development workflow by providing:
  • Automated code reviews for pull requests
  • AI-powered suggestions and One-Click Fixes
  • Interactive assistance through the CodeRabbit bot for real-time feedback
To interact with CodeRabbit in pull request comments, use @coderabbitai — or the username of the service account you configure below, if it differs.

Authentication

A Microsoft Entra service principal is the recommended authentication method, and the one new Azure DevOps organizations and new Enterprise SSO workspaces use, with a client ID and client secret. Existing PAT-based organizations and workspaces keep their current authentication flow. Select the tab that matches your setup.
Azure DevOps write operations require Identity: Read access (vso.identity) in addition to the relevant resource-specific write permissions. Grant this scope to the credential CodeRabbit uses so it can resolve identities before posting comments, updating pull requests, or performing other write operations.

Service principal authentication |

A service principal is the authentication method for new Azure DevOps organizations and new Enterprise SSO workspaces. CodeRabbit authenticates as a Microsoft Entra application that you add to your Azure DevOps organization. Existing PAT-based setups keep their current authentication flow.
A service principal is added to your Azure DevOps organization in the same way as a user and is authorized through Azure DevOps permissions. Your organization’s Microsoft Entra policies may require an administrator to approve CodeRabbit’s Azure connection.
You must be a CodeRabbit organization administrator to submit the credentials. If you are not an organization administrator, ask one to complete the CodeRabbit step after the Microsoft Entra and Azure DevOps administrators configure the service principal. The CodeRabbit role does not grant Microsoft Entra or Azure DevOps permissions.At a high level, you will:
  1. Create a Microsoft Entra app registration and a client secret.
  2. Add the app’s service principal to your Azure DevOps organization.
  3. Grant it the Azure DevOps permissions CodeRabbit needs.
  4. Enter the app’s Client ID and Client Secret in CodeRabbit.
CodeRabbit usually detects your Microsoft Entra tenant from the Azure DevOps organization. If detection fails, the setup asks you to connect Azure once; the client ID and client secret stay in the form while you complete the connection.

Prerequisites for a service principal

  • Permission to create an app registration in your Microsoft Entra tenant. If you can’t, ask a Microsoft Entra administrator to create one for you.
  • Project Administrator or Project Collection Administrator in Azure DevOps, to add the service principal and grant its permissions.
  • Azure DevOps permissions to read code, manage pull requests, and read and write work items.
  • Microsoft Entra ID enabled for the Azure DevOps organization.
  • A new service-principal onboarding flow does not fall back to a Personal Access Token.

Step 1: Create a Microsoft Entra app registration

1

Open App registrations

In the Azure portal, go to Microsoft Entra IDApp registrations, then select New registration.
2

Register the application

Configure the registration:
  • Name: a recognizable name such as CodeRabbit Service Principal.
  • Supported account types: select Accounts in this organizational directory only (Default Directory only - Single tenant).
  • Redirect URI: leave this blank. It is optional and is not needed for a service principal.
Then select Register.
3

Record the Client ID

On the app’s Overview page, copy the Application (client) ID. You enter this in CodeRabbit as the Client ID.

Step 2: Create a client secret

1

Open Certificates & secrets

In the app registration, go to Certificates & secretsClient secrets, then select New client secret.
2

Create and copy the secret

Add a description and an expiration, select Add, then copy the secret Value immediately. It is shown only once. You enter this in CodeRabbit as the Client Secret.
Client secrets expire. Set a reminder to create a new secret and update it in CodeRabbit before the expiration date, or reviews stop until you provide a new one.

Step 3: Add the service principal to your organization

1

Open Users in organization settings

In Azure DevOps, go to Organization settingsUsers, then select Add users.
2

Add the service principal

In the Users field, search for the app registration by its name (or paste its Application (client) ID) and select it. Set the Access level to Basic, add it to at least one project, and select Add.
Adding a service principal to an organization requires the organization to be connected to Microsoft Entra ID. See Prerequisites for a service principal.

Step 4: Grant the required permissions

CodeRabbit needs two kinds of Azure DevOps permission: standard repository and work-item access, and permission to manage service hooks (webhooks). Grant both on each project whose repositories CodeRabbit reviews.
Repository and work item access
We recommend adding the service principal to each project’s Contributors group, which grants everything CodeRabbit needs for reviews in a single step: go to Project settingsPermissionsContributorsMembersAdd, and add the service principal. This is a recommendation, not a requirement — you can give the service principal the equivalent permissions any way you prefer (a custom group or explicit permission grants), as long as it ends up with the access below. Make sure every project CodeRabbit reviews has these capabilities:
Service hooks (webhook) permission
CodeRabbit installs a webhook to receive pull request events, which requires the Edit Subscriptions permission on Service Hooks. At the time of writing, this permission cannot be granted from the Azure DevOps UI and must be set per project with the Azure CLI — install the extension with az extension add --name azure-devops and sign in as an administrator.
Without the Edit Subscriptions permission, CodeRabbit connects successfully but cannot install the webhooks that trigger reviews, so pull requests are never reviewed. This permission is project-scoped — repeat these steps for every project CodeRabbit reviews.
1

Get the project ID

2

Get the service principal descriptor

Find your service principal in the response and copy its descriptor value. The API can return multiple pages. If the service principal is not in the first response, follow the x-ms-continuationtoken response header and repeat the request with --query-parameters continuationToken=TOKEN until the header is absent. See the Service Principals - List API.
3

Grant Edit Subscriptions on the project

Replace SP_DESCRIPTOR with the descriptor from the previous step and PROJECT_ID with the ID from the first step. The namespace ID is the fixed identifier for the Service Hooks security namespace; --allow-bit 3 grants View and Edit Subscriptions, and --merge true preserves the service principal’s other permissions.

Step 5: Connect the service principal in CodeRabbit

1

Open the Azure DevOps settings

In the CodeRabbit application, start Azure DevOps onboarding for a new organization. For an Enterprise SSO workspace, open the workspace provider settings instead. You must be a CodeRabbit organization administrator.
2

Enter the credentials

Paste the Client ID and Client Secret from Steps 1 and 2. If CodeRabbit cannot detect the Microsoft Entra tenant, follow the prompt to connect Azure once, then return to the form and submit the retained credentials. CodeRabbit validates the service principal before saving it. If validation fails, recheck the permissions in Step 4.
3

Reuse a matching credential when available

Enterprise SSO workspace onboarding can reuse an existing organization credential when its authentication type matches the workspace setup. Credentials entered in the form take precedence over a selected reusable credential.
New service-principal onboarding does not fall back to a Personal Access Token. Existing PAT-based setups continue to work, but replacing a working credential with a service principal is currently available only for approved migrations. Contact CodeRabbit support if you need to migrate an existing setup.

Manual webhook installation

If you install repositories from the Repositories page, CodeRabbit creates the Azure DevOps service hooks automatically. Use this flow when you want to create the service hooks yourself — for example, when the account connected to CodeRabbit cannot read every project, or when you want to script the setup across many repositories — or when you need to rotate the shared webhook secret.
1

Open Webhook Secret settings

In the CodeRabbit app, open Account and select Webhook Secret from the sidebar.
2

Copy the webhook URL and organization ID

Use the Webhook URL and Organization ID fields on that page to copy the endpoint your service hooks should call and the value they must send in the x-coderabbit-org header.
3

Save the webhook secret

Enter the secret that Azure DevOps should send with webhook deliveries and save it in CodeRabbit. Service hooks send it in the x-coderabbit-webhook-secret header.
4

Create the service hooks

Create Web Hooks service hook subscriptions that POST to the copied webhook URL, sending both HTTP headers, for these events:
  • Pull request created, Pull request updated, Pull request merge attempted and Pull request commented on for each repository
  • Work item created, Work item updated and Work item commented on once per project
You can create them in the Azure DevOps project settings UI or with the script below.
When a valid webhook arrives for a repository that is not yet installed in CodeRabbit, the repository is registered automatically — you do not need to add it from the Repositories page.
If you change an existing webhook secret, CodeRabbit attempts to update existing CodeRabbit-managed Azure DevOps service hooks automatically. If a service hook was created manually, or if an automatic refresh fails, rerun the script below with the new secret and the -f flag (it replaces existing hooks that point at the CodeRabbit webhook URL) or update the headers directly in Azure DevOps.

Bulk service hook installation

For administrators managing many Azure DevOps repositories, use a script to create the service hooks across a repository, a project, or every project in the organization. Below is a sample script that requires:
  • Your Azure DevOps organization name
  • The webhook URL, organization ID, and webhook secret from the steps above
  • An Azure DevOps personal access token that can manage service hooks. Full access is simplest; a scoped token needs Project and Team: Read (to list projects), Code: Read (to list repositories), Work Items: Read (for the work-item subscriptions), and Service Hooks: Read & manage
The x-coderabbit-webhook-secret header on manually created service hooks carries the shared secret itself. Anyone who can view the service hook configuration in Azure DevOps can read it, so scope your webhook secret accordingly and rotate it from the CodeRabbit Webhook Secret page when needed.

What’s next

Quickstart

Open your first pull request and watch CodeRabbit post an automated review in minutes.

Configure CodeRabbit

Customize review behavior, language settings, and rules for your Azure DevOps repositories.

Code review overview

Learn how CodeRabbit reviews your pull requests and delivers actionable feedback.