---
title: "Azure DevOps"
description: "Connect Azure DevOps to Baz with Microsoft sign-in or a personal access token, and choose the projects and repositories to review."
canonical: "https://baz.ai/docs/connect/azure-devops"
---

# Azure DevOps

Connect Azure DevOps to Baz with Microsoft sign-in or a personal access token, and choose the projects and repositories to review.

Baz connects to Azure DevOps in one of two ways. With Microsoft OAuth, Baz acts through a service principal it adds to your organization. With a personal access token (PAT), Baz acts as a dedicated account you control. Either way, you choose which projects and repositories Baz reviews, and Baz registers and removes its service hooks for you.

## Choose a connection method

**Microsoft OAuth** is the easier choice if your organization uses Microsoft Entra ID: a Project Collection Administrator connects once, and Baz adds its own service principal with access only to the projects you pick. Choose a **personal access token** if your organization isn't on Entra ID. Baz then acts as the token's account, so use a dedicated service account and control its access through project membership.

## Connect

<Tabs>
  <Tab title="Microsoft OAuth">
    <Steps>
      <Step title="Check your role" icon="key-round">
        You must be a **Project Collection Administrator** of the Azure DevOps organization. Connecting adds Baz's service principal to the organization and registers service hook subscriptions, which need **Edit subscriptions**. Check it in **Organization Settings → Permissions → Project Collection Administrators**.
      </Step>
      <Step title="Start the connection" icon="plug">
        In onboarding, select **Connect Azure DevOps** under "Using Azure DevOps?". From an existing organization, open **Settings → Integrations → Azure DevOps**. In the **Connect Azure DevOps** dialog, select **Connect**.
      </Step>
      <Step title="Sign in with Microsoft" icon="users">
        Review the requested permissions on Microsoft's page and select **Accept**.
      </Step>
      <Step title="Select projects and repositories" icon="check-check">
        Under **Select an Azure DevOps Account**, choose the organization, then the projects and repositories, and select **Continue**. Repositories appear as `<organization>/<project>/<repository>`.
      </Step>
    </Steps>
:::warning
OAuth requires an organization backed by Microsoft Entra ID. An organization backed by a personal Microsoft account fails with "This action is only supported for Microsoft Entra backed organizations". Use a personal access token instead.
:::
  </Tab>
  <Tab title="Personal access token">
    <Steps>
      <Step title="Create a service account" icon="users">
        Invite a dedicated user, for example `baz-service@yourcompany.com`, from **Organization Settings → Users**, with the **Basic** access level. Stakeholder does not include Azure Repos.
      </Step>
      <Step title="Grant project access" icon="key-round">
        Add the account to **Project Administrators** in each project Baz should review (**Project Settings → Permissions**). Contributor is not enough, because Baz registers service hooks. Adding it to **Project Collection Administrators** covers every project, but gives the token organization-wide reach.
      </Step>
      <Step title="Generate the token" icon="lock">
        Sign in as the service account, open **User settings → Personal access tokens → New Token**, pick your organization, set the longest expiry your policy allows, and choose **Custom defined** with the scopes below.
      </Step>
      <Step title="Connect it in Baz" icon="plug">
        In the **Connect Azure DevOps** dialog, expand **Connect with a Personal Access Token instead**. Enter the **Organization URL** (for example `https://dev.azure.com/your-organization`) and the **Personal Access Token**, then select **Connect with token**.
      </Step>
      <Step title="Select repositories" icon="check-check">
        Baz lists the projects the account can see. A missing project means the account has not been added to it.
      </Step>
    </Steps>

Give the token **Code (Read & write)** and **Code (Status)** so Baz can read pull requests, comment, and report review status. Add read access to **Work items**, **Project and team**, **Graph**, **Identity**, and **User profile** so Baz can pull in Azure Boards context, list your projects, and map users and groups.

:::warning
Baz cannot read a token's expiry. Track the renewal date yourself: the integration fails with authentication errors once the token expires. To rotate it, create a new integration with the new token.
:::
  </Tab>
</Tabs>

## Service hooks

When you add a project, Baz registers service hooks on it for four events: code pushed, pull request created, pull request updated, and pull request commented on. When you remove a project, Baz removes its hooks. You can see them in **Project Settings → Service hooks**. Do not delete them: Baz uses them to detect PRs and review activity.

Azure DevOps has no check runs, so Baz reports review progress as a PR status.

## Manage the integration

Only admins can change the project and repository selection. Go to **Settings → Integrations → Azure DevOps** to add or remove projects and repositories, or to reconnect. If you connected before project-scoped selection existed, reconnect to choose specific projects instead of the whole organization.

## Related

<CardGroup cols={2}>
  <Card title="Azure Boards" href="/docs/integrations/ticketing/azure-boards" icon="layers">
    Add work item context to reviews.
  </Card>
  <Card title="Quickstart" href="/docs/quickstart" icon="rocket">
    From connection to first review.
  </Card>
  <Card title="Pull requests" href="/docs/work/pull-requests" icon="git-pull-request">
    Read and act on Baz reviews.
  </Card>
  <Card title="Data protection" href="/docs/security/data-protection" icon="lock">
    How Baz stores your credentials.
  </Card>
</CardGroup>
