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

# Azure DevOps

> Connect Azure DevOps so MergeGuide evaluates pull requests and reports results.

MergeGuide integrates with **Azure DevOps** to evaluate pull requests. When a PR is
opened or updated, MergeGuide checks the changes against your policies and reports
the result back on the pull request.

## How it works

Once connected, MergeGuide receives pull request events from your Azure DevOps
project through a service hook. On a relevant event it evaluates the changed code
and posts the result to the PR. Blocking findings hold the merge until resolved.

## Connect Azure DevOps

<Steps>
  <Step title="Add the repository in the dashboard">
    In [portal.mergeguide.com](https://portal.mergeguide.com), open
    **Repositories** and connect your Azure DevOps repository.
  </Step>

  <Step title="Create a service hook">
    In your Azure DevOps project settings, add a service hook for pull request
    events using the URL and shared secret MergeGuide provides. The secret lets
    MergeGuide verify that requests genuinely come from Azure DevOps.
  </Step>

  <Step title="Open a pull request">
    Open or update a PR. MergeGuide evaluates the change and reports the result on
    the pull request.
  </Step>
</Steps>

## Run in Azure Pipelines

You can also run MergeGuide as a pipeline step. Install the CLI and run a check:

```yaml azure-pipelines.yml theme={null}
trigger: none

pr:
  - main

pool:
  vmImage: ubuntu-latest

steps:
  - task: UsePythonVersion@0
    inputs:
      versionSpec: '3.11'
  - script: |
      pip install mergeguide
      mergeguide check . --fail-on-warning
    displayName: 'MergeGuide policy check'
```

See [CI/CD patterns](/integrations/ci-cd-patterns) for the general pipeline recipe.

## Block merges on findings

Require the MergeGuide check to pass before completing a PR using branch policies in
your Azure DevOps repository settings. See [Set up the PR gate](/install/pr-gate).

## Next steps

<CardGroup cols={2}>
  <Card title="PR gate" icon="code-pull-request" href="/install/pr-gate">
    Block merges on blocking findings.
  </Card>

  <Card title="CI/CD patterns" icon="arrows-spin" href="/integrations/ci-cd-patterns">
    Wire MergeGuide into any pipeline.
  </Card>
</CardGroup>
