# Azure Repos
URL: https://docs.clearly-ai.com/docs/integrations/code/azure-repos
Description: Connect Clearly AI to Azure DevOps repositories.
Connect Azure Repos so Clearly AI can use Azure DevOps repositories and branches as Project sources.

Azure Repos is separate from [Azure DevOps Work Items](https://docs.clearly-ai.com/docs/integrations/issue-trackers/azure-devops-work-items). Use this page for code repositories. Use the Work Items page for tickets.

<Note>
  Create the PAT from an Azure DevOps user or service account that can access the repositories Clearly AI should read. Grant **Code: Read** for repository sources, or **Code: Read & Write** if Workflows should write pull request comments.
</Note>

## Create an Azure DevOps PAT [#create-an-azure-devops-pat]

1. In Azure DevOps, open **User settings > Personal access tokens**.
2. Click **New Token**.
3. Choose the organization Clearly AI should access.
4. Set an expiration date that matches your security policy.
5. Grant **Code: Read** for source ingestion, or **Code: Read & Write** if Clearly AI should write pull request comments.
6. Create the token and copy it. Azure DevOps shows it only once.

## Connect Azure Repos in Clearly AI [#connect-azure-repos-in-clearly-ai]

1. In Clearly AI, open **Organization settings**, select **Integrations**, then click **Set up** on the Azure DevOps Repos card.
2. In **Organization ID**, enter the Azure DevOps organization name from `https://dev.azure.com/<organization>`.
3. Under **Authentication**, in **Shared API Token**, paste the PAT.
4. Check **I understand** under the shared-credential notice, then click **Add workspace credential**. Clearly AI tests the credential and enables the integration only when the test passes.

The connection test verifies the organization and basic repository access.

## Add an Azure Repos branch as a source [#add-an-azure-repos-branch-as-a-source]

1. Open a Project.
2. Open **Manage Sources** and click **Search Integrations**.
3. Select **Azure DevOps Repository**.
4. Choose the Azure DevOps project.
5. Choose the repository.
6. Choose the branch. Clearly AI prefers the API-reported default branch when available.
7. Save the source and wait for processing.

Clearly AI downloads the selected branch, filters common junk files, and stores the result as Project context for Reviews and Chat.

## Narrow large repositories [#narrow-large-repositories]

Repository sources can be large. When needed, use file include and exclude patterns in the source configuration.

Examples:

```text
files_to_include: ["src/**", "infra/**"]
files_to_exclude: ["node_modules", "*.log", "*.test.*", ".*"]
```

## FAQs [#faqs]

<Accordions>
  <Accordion title="Why does the connection test fail with access denied?">
    Confirm the PAT is active and has **Code: Read** access for the organization and project.
  </Accordion>

  <Accordion title="Why don't projects or repositories appear?">
    Confirm the token owner can see the project and repository directly in Azure DevOps.
  </Accordion>

  <Accordion title="What should I do if the source is too large or slow to process?">
    Select a smaller branch or narrow the file patterns before saving the source.
  </Accordion>

  <Accordion title="Which Azure DevOps integration should I use?">
    Use **Azure DevOps Repository** for code. Use **Azure DevOps Work Items** for tickets.
  </Accordion>
</Accordions>

## Related [#related]

* [Azure DevOps Work Items](https://docs.clearly-ai.com/docs/integrations/issue-trackers/azure-devops-work-items)
* [Reviews](https://docs.clearly-ai.com/docs/reviews)
* [Integrations](https://docs.clearly-ai.com/docs/integrations)