Integrating CodeRabbit with Azure DevOps
This guide will assist you in effectively integrating CodeRabbit with AzureDevOps.
Prerequisites
- An active Azure DevOps account.
- Use of organizational email addresses is required; personal email addressesare not supported for this integration.
Integration Instructions
Log in to the CodeRabbitAI application.
After logging in, you will be redirected to a page displaying Microsoft Appsconsent requests. Please forward these requests to your administrator forapproval.
warningIf you are an administrator, you may approve the applications directly. If not,please contact your administrator to request approval for the applications.
Once your administrator has approved the applications, click "Continue."
You will be redirected to the "Onboarding" page, where you can select theorganization you wish to integrate with.
On the "Azure DevOps User" page, enter your Personal Access Token for AzureDevOps.
To install CodeRabbit on a repository, toggle the switch on the"Repositories" page.
How it works
For the CodeRabbit app to post reviews on merge requests, it needs to interactwith the Azure DevOps API, which requires a Personal Access Token. This tokencan be generated by creating a Personal Access Token from one of your existingusers.
You can create a new user in Azure DevOps and generate a Personal Access Tokenfor that user, followingour recommendations.
Azure DevOps Personal Access Tokens
To interact with the Azure DevOps API, aPersonal Access Token is required.This token can be generated by creating aPersonal Access Token from one ofyour existing users.
Upon first login to the application (immediately after the onboarding screen),you will need to add the Personal Access Token.
Recommendations
- Create a dedicated user for CodeRabbit - This ensures the user isexclusively for CodeRabbit, allowing better access control.
- Use "CodeRabbit" as the username - This makes the user easily recognizablefor future reference.
- Use a dedicated email address - This helps in easy identification andmanagement.
- Use the CodeRabbit logo as the profile picture - This further ensures easyrecognition. You can download our logo fromhere.
Key Points to Remember
- Personal access tokens have expiration dates. Ensure the expiration datecovers the duration of your intended use of the CodeRabbit app.
- Code reviews will be attributed to the owner of the personal access token.
- If the personal access token expires, you can add a new one via the CodeRabbitUI:
- Navigate to the "AzureDevOps User" page in the sidebar.
- Add the new token and click save.
Generating a Personal Access Token
Azure DevOps provides an option to generate a personal access token for a user.Follow these steps to generate the token:
- Log in as the user intended for CodeRabbit reviews.
- Next to your avatar on the headers right side is a settings icon, click it.
- Choose "Personal Access Tokens"
- Click "New Token"
- Select the organization you want to use the token with or select "Allaccessible organizations."
- Enter a name and an expiry date for the token.
- We need to have read & write access to "Work Items" & "Code" to post reviewson pull requests. If you are on the Pro tier also add "Build" access for pipelinefailure remediation.
- Click "Create"