> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/harness-platform/use-harness-platform/connectors/code-repositories/add-an-azure-repos-connector.md).

# Add an Azure Repos connector

Add an Azure Repos connector so Harness pipelines can pull code and other files from your Azure Repos projects and repositories.

Azure Repos is part of Azure DevOps and offers two version control models: Git, a distributed system compatible with standard Git tools, and Team Foundation Version Control (TFVC), a centralized system, specific to Azure DevOps. Harness connectors work with Azure Repos Git repositories. Harness does not support TFVC repositories because TFVC is not Git-compatible.

You connect Harness to Azure Repos using a Harness Azure Repos connector. The connector allows you to pull code and other files, such as Helm charts, Kubernetes manifests, and Terraform scripts, from your Azure Repos repositories for use in Harness pipelines.

Go to [Overview](/harness-platform/use-harness-platform/connectors/code-repositories/code-repositories-connectors-overview.md) for information about all code repos connectors, such as scopes, permissions and connectivity modes.

## What you will learn from this topic

* How to [add an Azure Repos connector](#add-an-azure-repos-connector) to a Harness project so pipelines can pull code from Azure Repos.

***

## Before you begin

Before you create an Azure Repos connector, ensure you have:

* An Azure DevOps organization with at least one project and one repository.
* A username and password, or a personal access token, with permission to read (and, if needed, write status checks to) the repositories you want to connect to.
* Permission to create connectors in Harness.

***

## Add an Azure Repos connector

You can add an Azure Repos connector at the project, org, or account scope. This procedure covers the project scope, and the process is the same for org and account.

You can also add an Azure Repos connector directly when configuring an Azure Repos codebase or artifact source in a pipeline or service.

Perform the following steps to add an Azure Repos connector:

1. Open your Harness project.
2. In **Project Settings**, select **Connectors**.
3. Click **New Connector**, then select **Azure Repos**. The Azure Repos Connector settings appear.

### Overview

Configure the identity fields for the connector.

In **Name**, enter a name for the connector. Optionally, add a description and tags. Click **Continue**.

![Azure Repos connector Overview step with Name, Description, and Tags fields.](https://173309742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3F2TpHXhur2QtQnORSM9%2Fuploads%2Fgit-blob-552c686c42103eb47465250b9f35084d3ac28796%2Fazure-repos-connector-overview.png?alt=media)

### Details

Configure the following details:

1. For **URL Type**, select one of:
   * **Project**: Connect to an entire Azure DevOps project. The connector can be used for every repository in that project.
   * **Repository**: Connect to a single Azure Repos repository.
2. For **Connection Type**, select **HTTP** or **SSH**.
3. Enter the **Azure Repos Project URL** or **Azure Repos Repository URL**, depending on the URL Type you selected. For example:
   * Repository URL (HTTP): `https://ORG_OR_USER@dev.azure.com/ORG_NAME/PROJECT_NAME/_git/REPO_NAME`
   * Project URL (HTTP): `https://dev.azure.com/ORG_NAME/PROJECT_NAME` or `https://ORG_OR_USER@dev.azure.com/ORG_NAME/PROJECT_NAME`

{% hint style="warning" %}
**Exclude `_git` and the repo name from a Project URL**

When you copy a Project URL from Azure Repos, remove `_git/REPO_NAME` from the URL path. Invalid formats include `https://dev.azure.com/ORG/PROJECT/_git` and `https://dev.azure.com/ORG/PROJECT/_git/REPO`. A valid Project URL looks like `https://dev.azure.com/ORG/PROJECT`.
{% endhint %}

4. If you selected **Project** for URL Type, enter a **Test Repository**. Harness uses this repository only to validate the connection. You specify the actual repository to use when you reference the connector in a pipeline.
5. Click **Continue**.

![Azure Repos connector Details step with URL Type, Connection Type, Azure Repos Project URL, and Test Repository fields.](https://173309742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3F2TpHXhur2QtQnORSM9%2Fuploads%2Fgit-blob-44bcee9cc95be7d67bd1a5a2e4374cdc0763358e%2Fazure-repos-connector-details.png?alt=media)

### Credentials

Configure the credentials based on the connection type you selected:

* If you selected **HTTP**:
  * **Username**: Enter your Azure DevOps username. You can use plaintext or a [Harness encrypted text secret](/harness-platform/use-harness-platform/secrets/add-use-text-secrets.md).
  * **Personal Access Token**: Select or create a new [Harness encrypted text secret](/harness-platform/use-harness-platform/secrets/add-use-text-secrets.md) to store your personal access token.
* If you selected **SSH**:
  * Select or create a new [Harness SSH credential secret](/harness-platform/use-harness-platform/secrets/add-use-ssh-secrets.md) to store your SSH private key. The SSH credential's **Username** must be `git`. Go to the Microsoft documentation on [Using SSH keys to authenticate](https://docs.microsoft.com/en-us/azure/devops/repos/git/use-ssh-keys-to-authenticate) to generate a key.

{% hint style="info" %}
**Enable API access for build status updates and triggers**

If you want to use Git Experience, send build or PR status updates back to Azure Repos, or to support Git event triggers and webhooks using the connector, select **Enable API access** and provide an [Azure Repos personal access token](https://learn.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate?view=azure-devops\&tabs=Windows#create-a-pat) as a [Harness encrypted text secret](/harness-platform/use-harness-platform/secrets/add-use-text-secrets.md).
{% endhint %}

![Azure Repos connector Credentials step with Authentication set to SSH Key and Enable API access selected.](https://173309742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3F2TpHXhur2QtQnORSM9%2Fuploads%2Fgit-blob-194bc2bc8e7b8d0fb5fdca00dfc0319beb92a978%2Fazure-repos-connector-credentials.png?alt=media)

### Select Connectivity Mode

Select how Harness connects with Azure Repos:

* **Connect through Harness Platform**: Use a direct, secure communication between Harness and Azure Repos. All credentials are encrypted and stored in the Secret Manager configured in Harness. This connectivity mode is required for [Harness Cloud build infrastructure](https://developer.harness.io/docs/continuous-integration/use-ci/set-up-build-infrastructure/use-harness-cloud-build-infrastructure/).
* **Connect through a Harness Delegate**: Harness communicates with Azure Repos through a Harness Delegate you install in your environment, behind your corporate firewall.

![Select Connectivity Mode step showing Connect through a Harness Delegate and Connect through Harness Platform options.](https://173309742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3F2TpHXhur2QtQnORSM9%2Fuploads%2Fgit-blob-060972668332d9b9e424c77c9799b0206172e6b1%2Fazure-repos-connector-connectivity-mode.png?alt=media)

### Delegates Setup

If you selected **Connect through a Harness Delegate**, select either:

* **Use any available Delegate**: Harness selects an available delegate at runtime.
* **Only use Delegates with all of the following tags**: Select specific delegates for Harness to use with this connector.

Click **Save and Continue**.

![Azure Repos connector Delegates Setup step with Use any available Delegate and Only use Delegates with all of the following tags options.](https://173309742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3F2TpHXhur2QtQnORSM9%2Fuploads%2Fgit-blob-3f4227d8679d0860e6c8fec6bcb0432d4403be08%2Fazure-repos-connector-delegates-setup.png?alt=media)

### Test Connection

Click **Finish** after the connection test succeeds. The connector is listed in **Connectors**.

If the connection test fails:

* Confirm the project or repository URL matches the format for your selected URL Type and Connection Type, and that a Project URL excludes `_git` and the repo name.
* Confirm the credential secret has not expired and has the required repository permissions.
* If you are connecting through a delegate, confirm the delegate can reach Azure DevOps over the network.

{% hint style="info" %}
**Kubernetes delegate with self-signed certificates**

If this connector allows API access and connects through a Harness Delegate that uses self-signed certificates, you must specify `ADDITIONAL_CERTS_PATH` in the delegate pod. Go to [Configure a Kubernetes build farm to use self-signed certificates](https://developer.harness.io/docs/continuous-integration/use-ci/set-up-build-infrastructure/k8s-build-infrastructure/configure-a-kubernetes-build-farm-to-use-self-signed-certificates) for details.
{% endhint %}

***

## Sample YAML

The following example shows a YAML for the Azure Repos connector created in this guide.

<details>

<summary>YAML - Azure Repos connector</summary>

```yaml
connector:
  name: your-azure-repos-connector # Replace with a name for your connector
  identifier: yourazurereposconnector # Replace with a unique identifier
  description: ""
  accountIdentifier: your-account-identifier # Replace with your Harness account identifier
  type: AzureRepo
  spec:
    url: yourazurereposrepourl # Replace with your Azure Repos project or repository URL
    authentication:
      type: Http # Use "Ssh" instead if you selected SSH as the Connection Type
      spec:
        type: UsernameToken
        spec:
          username: youraccountusername # Replace with your Azure DevOps username, or a Harness expression referencing a secret
          tokenRef: youraccesstoken # Replace with a reference to the Harness secret storing your personal access token
    apiAccess:
      type: Token
      spec:
        tokenRef: yourpersonalaccesstoken # Replace with a reference to the Harness secret storing the token used for Enable API access
    executeOnDelegate: true # Set to false if you selected Connect through Harness Platform
    ignoreTestConnection: false # Set to true only to skip connector preflight checks
    type: Repo # Use "Project" instead if you selected Project as the URL Type
```

</details>

For the full connector YAML schema, including how to skip connector preflight checks, go to [Create a connector using YAML](/harness-platform/use-harness-platform/connectors/create-a-connector-using-yaml.md).

***

## Next steps

* [Use delegate selectors](/harness-platform/use-harness-platform/delegates/delegate/manage-delegates/select-delegates-with-selectors.md): control which delegates can connect to this connector.
* [Add a secret manager](/harness-platform/use-harness-platform/secrets/secrets-management.md): store connector credentials in a secret manager instead of the Harness built-in secret manager.
