Connect to Azure Repos
Azure Repos is a set of version control tools that you can use to manage your code. Azure Repos provides Git distributed version control and Team Foundation centralized version control (TFVC).
You can use a Harness Azure Repos connector to connect to Azure Repos Projects and individual repositories.
Requirements
You must have:
- An Azure Project and at least one repo.
- Permission to create connectors in Harness.
- A Harness project.
Create the connector
-
In Harness, go to Project Settings, Organization Settings, or Account Settings, depending on the scope where you want to create the connector. For example, a connector created at the project scope is only available within that project.
-
Select Connectors, select New Connector, and then select the Azure Repos connector.
-
Enter a Name for your connector, and then select Continue.
-
Select Project or Repository for the URL Type.
-
Select HTTP or SSH for the Connection Type.
-
Enter your Azure Repos Project or Repository URL.
Make sure the URL uses the correct format for the URL Type and Connection Type. For example:
- HTTP Repository URL:
https://ORG_OR_USER@dev.azure.com/ORG_NAME/PROJECT_NAME/_git/REPO_NAME
- HTTP Project URL:
https://dev.azure.com/ORG_NAME/PROJECT_NAME
- HTTP Project URL:
https://ORG_OR_USER@dev.azure.com/ORG_NAME/PROJECT_NAME
You can get the URL from Azure Repos.
Project URLsWhen copying Project URLs from Azure Repos remove
_git/REPO_NAME
from the URL path.For Project URLs, don't include
_git
or a repo name in the Azure Repos Project URL field.Examples of invalid Azure Repos Project URL formats include:
https://USER@dev.azure.com/ORG/PROJECT/_git
https://USER@dev.azure.com/ORG/PROJECT/_git/REPO
https://dev.azure.com/ORG/PROJECT/_git
https://dev.azure.com/ORG/PROJECT/_git/REPO
To make these valid, exclude
_git
and the repo name. For example, these are valid Azure Repos Project URLs:https://USER@dev.azure.com/ORG/PROJECT
https://dev.azure.com/ORG/PROJECT
- HTTP Repository URL:
-
If you selected Project, in Test Repository, enter the name of a repository that Harness can use to test the connector's connection.
-
Select Continue, and then configure Credentials based on the Connection Type:
-
For HTTP connections, enter the username and password to access the project or repo.
-
For SSH connections, you must provide an SSH private key stored in a Harness encrypted text secret. You can use
ssh-keygen -t rsa
to create a private SSH key. For more information, go to the Microsoft documentation on Creating SSH Keys.
-
-
If required, select Enable API Access. This is recommended, and it is required to use Git event triggers, webhooks, and send build and PR statuses between Azure Repos and Harness.
-
You need an Azure Repos Personal Access Token to enable API access.
-
In Personal Access Token, select a Harness encrypted text secret containing an Azure Repos Personal Access Token. Harness requires the token for API access. Generate the token in your Azure account, and then add it to Harness as a secret.
-
-
Select Continue, and then select whether to connect through the Harness Platform or a Harness Delegate. If you plan to use this connector with Harness Cloud build infrastructure, you must select Connect through Harness Platform.
-
If you selected Connect through a Harness Delegate, you must configure the delegate connection. 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 that you want Harness to use with this connector.
- Select Save and Continue, and then wait while Harness tests the connector's connection. If the test succeeds, select Finish.
Kubernetes delegate with self-signed certificates
If your codebase 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, as described in Configure a Kubernetes build farm to use self-signed certificates.