> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hacktron.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Azure DevOps

> Configure repository access for Azure DevOps Services and Azure DevOps Server.

## Prerequisites

You need to be an administrator of the Azure DevOps organization you want to
connect to Hacktron. This is required to create a Personal Access Token with the
scopes Hacktron uses to read code, post pull request statuses, and register the
service hooks that trigger reviews.

## Configure access

<Steps>
  <Step title="Open Personal Access Tokens">
    In Azure DevOps, open **User settings** (the icon next to your avatar in the
    top right) and select **Personal access tokens**.

    <img src="https://mintcdn.com/hacktronai/OCfIxIMNjD7oLTRt/images/azure_pat.png?fit=max&auto=format&n=OCfIxIMNjD7oLTRt&q=85&s=923cd0b800246347171e8e66154b6f5a" alt="Azure DevOps Personal Access Tokens" width="2560" height="1312" data-path="images/azure_pat.png" />
  </Step>

  <Step title="Create a new token">
    Click **New Token**. Give it a descriptive name, e.g. "Hacktron", and select
    the organization you want to connect.

    <img src="https://mintcdn.com/hacktronai/OCfIxIMNjD7oLTRt/images/azure_new_token.png?fit=max&auto=format&n=OCfIxIMNjD7oLTRt&q=85&s=a59f6d995e01a110820c9c695be6e53d" alt="Create Azure DevOps Token" width="964" height="1311" data-path="images/azure_new_token.png" />

    <Warning>
      **Personal access tokens have expiration dates.** Set the expiration to
      cover the duration of your intended use of Hacktron to avoid service
      interruption.
    </Warning>
  </Step>

  <Step title="Grant the required scopes">
    Switch the scope selector to **Show all scopes** and grant the following:

    * **Code** - "Read & write" and "Status"
    * **Project and Team** - "Read"
    * **Service Connections** - "Read, query & manage"
    * **Identity** - "Read"

    <Info>
      The "Read & write" Code scope lets Hacktron clone repositories and post
      review comments; "Status" lets it report pull request check results. The
      Service Connections scope lets Hacktron register the service hooks that
      notify it when a pull request is opened or updated, so reviews run
      automatically. Hacktron does not retain any source code after each review
      is complete.
    </Info>

    <img src="https://mintcdn.com/hacktronai/OCfIxIMNjD7oLTRt/images/azure_scopes.png?fit=max&auto=format&n=OCfIxIMNjD7oLTRt&q=85&s=27c11d6e1e494bb13c30d10a159209e7" alt="Azure DevOps Token Scopes" width="2118" height="409" data-path="images/azure_scopes.png" />

    Click **Create**, then copy the generated token. Azure DevOps shows it only
    once.

    <img src="https://mintcdn.com/hacktronai/w8AZ2C8uxq-DITi1/images/azure_copy_token.png?fit=max&auto=format&n=w8AZ2C8uxq-DITi1&q=85&s=8f6b1cc976b1b2088319b16c7a7fed3c" alt="Azure DevOps Copy Token" width="725" height="463" data-path="images/azure_copy_token.png" />
  </Step>

  <Step title="Open Integrations page">
    In Hacktron, go to **Integrations** and click **Connect** under **Azure
    DevOps**.

    <img src="https://mintcdn.com/hacktronai/OCfIxIMNjD7oLTRt/images/azure.png?fit=max&auto=format&n=OCfIxIMNjD7oLTRt&q=85&s=c7cf9a25fbf7213d19bcc5a7daeba8a2" alt="Azure DevOps Integration" width="552" height="276" data-path="images/azure.png" />
  </Step>

  <Step title="Enter the token">
    Enter your organization URL (e.g. [https://dev.azure.com/hacktronai](https://dev.azure.com/hacktronai)) and the token you created earlier, and click **Connect**.

    <img src="https://mintcdn.com/hacktronai/OCfIxIMNjD7oLTRt/images/azure_devops_connect.png?fit=max&auto=format&n=OCfIxIMNjD7oLTRt&q=85&s=a32695673ead563df4d4b27d0e7499a3" alt="Azure DevOps Integration Connect Step" width="768" height="1233" data-path="images/azure_devops_connect.png" />
  </Step>

  <Step title="Select your repository scopes">
    Select the repositories that you want Hacktron to have access to.

    <img src="https://mintcdn.com/hacktronai/OCfIxIMNjD7oLTRt/images/azure_devops_select_repositories.png?fit=max&auto=format&n=OCfIxIMNjD7oLTRt&q=85&s=5ea94b1c2b93f0c8a29425eb9a1573c7" alt="Azure DevOps Integration Select Repositories" width="768" height="732" data-path="images/azure_devops_select_repositories.png" />
  </Step>
</Steps>

That's it! Hacktron will now run security reviews for every pull request in the selected repositories.

## Azure DevOps Server

Hacktron supports self-hosted Azure DevOps Server through the same Personal
Access Token flow described above. The only difference is one extra step when
you connect.

Follow the same **Configure access** steps to create a Personal Access Token
with the same scopes on your Azure DevOps Server instance.

When you open the **Connect Azure DevOps** modal in Hacktron, select **Azure
DevOps Server** and enter your instance's base URL and organization (e.g.
`https://azuredevops.example.com/DefaultCollection`) as well.

<Note>
  Self-hosted prerequisites: - Your Azure DevOps Server instance must be
  reachable from Hacktron over HTTPS with a valid TLS certificate. - The token
  must carry the same scopes listed above on your Azure DevOps Server instance.
</Note>
