> For the complete documentation index, see [llms.txt](https://docs.loci-dev.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.loci-dev.net/quick-start-loci-azure-devops-integration.md).

# Quick-Start LOCI Azure DevOps Integration

The **LOCI Azure DevOps** integration enables developers and engineering teams to automate performance analysis directly within their existing Azure Pipelines CI/CD workflo +ws. By connecting LOCI's hardware-aware optimization engine with Azure Pipelines and the `LociTask@1` extension task, teams gain immediate visibility into the performance i +mpact of every commit, build, and pull request — with findings delivered as PR thread comments before merge.

#### User Flow Overview

<figure><img src="/files/AbzkNcIQReXThigxOfHa" alt=""><figcaption></figcaption></figure>

**Setup steps (1–3)** are performed once per repository.&#x20;

**Usage steps (4–5)** repeat automatically on every pull request.

***

### Step-by-Step Guide

#### **Step 1 — Install the LOCI Azure DevOps Extension**

Install the **LOCI Azure DevOps Extension** from the [Azure DevOps Marketplace](https://marketplace.visualstudio.com/azuredevops). This extension provides the `LociTask@1` pipeline task that uploads your compiled binaries to the LOCI backend for hardware-aware performance analysis.

An active LOCI license is required. Contact <support@auroralabs.com> to obtain one.

#### **Step 2 — Add Your Credentials and Configure the Bot**

**LOCI dashboard** — Sign in as a company user, open **Company Details → Edit**, tick the **agentic** checkbox, and save. Copy your API key for the next step.

Add the following to your Azure DevOps pipeline:

* `LOCI_API_KEY` — pipeline **secret** variable (your LOCI API key)
* `LOCI_AZURE_PAT` — pipeline **secret** variable (the bot user PAT generated below)
* `LOCI_BACKEND_URL` — pipeline variable (not secret)

**Bot user** — Create a dedicated Azure DevOps user for LOCI. Generate a long-lived PAT for that user with the following scopes: **Code** (Read & Write), **Identity** (Read), **Pull Request Threads** (Read & Write), **Tokens** (Read & Manage). Store it as `LOCI_AZURE_PAT`. Also set **repository-url** on your LOCI project to the full Azure DevOps repo URL — without it the bot cannot route PR replies to the correct repository.

**Service hook** — In Azure DevOps go to **Project Settings → Service hooks → Create subscription**, choose **Web Hooks**, set the trigger to **Pull request commented on**, and point the URL to `<your_loci_dashboard_url>/webhook/azure`. This enables `@<bot-name>` chat to respond inline on PR threads.

#### **Step 3 — Add LociTask\@1 to Your Pipeline**

Add `LociTask@1` to your `azure-pipelines.yml` after your build step:

```yaml
trigger:
  branches:
    include: [main]
pr:
  branches:
    include: [main]

pool:
  vmImage: 'ubuntu-latest'

variables:
  LOCI_PROJECT: my-project

steps:
  - checkout: self
    fetchDepth: 0
    persistCredentials: true

  - script: echo "Build project here"
    displayName: 'Build project'

  - task: LociTask@1
    name: LOCI_Upload
    displayName: 'LOCI Upload'
    inputs:
      mode: upload
      project: $(LOCI_PROJECT)
      binaries: path/to/your/binaries/
      scmToken: $(LOCI_AZURE_PAT)
    env:
      LOCI_API_KEY: $(LOCI_API_KEY)
      LOCI_BACKEND_URL: $(LOCI_BACKEND_URL)
```

#### **Step 4 — Open a Pull Request**

Opening a PR against your target branch triggers the pipeline automatically. LOCI detects which functions changed between the PR branch and the base, runs hardware-aware execution analysis, and compares results against the baseline — no manual intervention required.

#### **Step 5 — Review the LOCI Report**

LOCI posts its findings as PR thread comments from the **loci-review** bot. Each comment includes execution timing deltas, control-flow analysis, and optimization recommendations grounded in real hardware traces. Mention `@<bot-name>` in any PR thread to query the analysis inline.

Results are also accessible via the dashboard URL printed in the `LociTask@1` task logs. On the **Checks** tab of your PR, select **Performance overview** for a full side-by-side comparison.

***

#### Next Steps

* [Explore the LOCI Azure DevOps Integration Overview](https://docs.loci-dev.net/ready-to-integrate-in-your-ci-cd/loci-azure-devops-integration-overview)
* [Explore the full Azure DevOps Technical Reference](https://docs.loci-dev.net/ready-to-integrate-in-your-ci-cd/loci-azure-devops-technical-reference)
* [LOCI for Azure DevOps README file](https://github.com/auroralabs-loci/loci-action/blob/azure_devops_support/azure/README.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.loci-dev.net/quick-start-loci-azure-devops-integration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
