Photo by Luke Chesser / Unsplash

How to Setup Repositories in Azure Devops

Daniel Makhoba Emmanuel

Table of Contents

DevOps teams handle a complex array of tools—such as Git, Jira, and CI/CD platforms—each playing a crucial role. However, managing these tools can lead to chaos due to constant context switching. Moreover, introducing a cloud like Azure, with its diverse APIs, can further complicate the creation of a smooth workflow.

This is where Azure DevOps comes into play. It's not just an "all-in-one" solution; it's a unified platform that seamlessly integrates core DevOps tools. Take web application development, for example. Using Git for version control, Jenkins for CI/CD, and a separate testing tool would require custom scripts and constant maintenance. Azure DevOps simplifies this process with its suite of built-in tools.

In this article, you will learn how to setup Azure Repos for your Azure Devops project.

Prerequisites

To follow along with this article, there are somethings you’ll need to know and set-up:

What is Azure DevOps

Azure DevOps is Microsoft’s solution for implementing DevOps in Azure. It’s an integrated suite of tools that provides services for planning, developing, testing, and deploying software projects and Azure infrastructure all in one place.

One of the key benefits of Azure DevOps is its seamless integration with the Azure portal. If your organization or you as an individual already uses Azure, it's worth considering Azure DevOps for your projects and DevOps process.

Azure Devops has 5 main services to assist the DevOps process: Azure Boards, Azure Repos, Azure Pipelines, Azure Test Plans and Azure Artifacts. However, in this article we’ll be focusing on Azure Repos, since it’s the main foundation in which everything is carried out.

Why do you need Azure Repos?

Azure Repos serves as your project’s repository as part of the suite of tools offered by Azure DevOps. It integrates seamlessly with the other services: Azure boards( for collaboration, planning, ticketing), Azure pipelines( for CI/CD), Azure Artifacts( for artifact repositories) and Azure Test plans( for testing).

Apart from integration, you can also configure several policies, settings and configurations that make development and maintenance easier.

Difference between Git and TFVC

Azure Repos supports two version control systems(VCS); Teams Foundation Version Control (TFVC) and Git.

The main difference you need to keep in mind is that Git is a distributed repository, whilst TFVC is centralized, meaning that if your team works remotely and want to maintain a pretty good level of flexibility, Git is your go too. If you want to know more about the differences between the two check out this article by Microsoft; Difference between Git and TFVC.

Setting Up Azure Repos

Setting up Azure Repos is a straight forward process, so in this section I’m going to walk through the entire process from project creation to finish.

First, You’ll need to create a “New project” in your organization. This option is available at the top right of your organization’s main page.

If you’re not sure how to get to the above page, you can go through the Azure portal by searching “Azure DevOps Services” or directly at dev.azure.com and you’ll end up at this page.

Secondly, after entering your project name and description, in the lower part of the section select the version control system you’d like to use (“Git” in this case). In the visibility section you can choose either “Public” or “Private” as both of them are free and will not incur any additional charges.

Afterwards, you’ll be greeted with a screen like in the image below. That is your Project page.

How to connect to Azure Repos

There are a couple of ways to connect to Azure Repos and depending on the situation some are more suited than others, so we’ll be taking them in scenarios.

In the Azure Repos section you’ll be created with a screen, that has multiple links and options like this;


Scenario 1: Cloning your Azure Repo

For this scenario, you’ll be cloning an already existing repository from Azure Repos to your machine using any IDE of your choice. In this scenario the repository automatically takes on the name of the “Project”.  So the first option of “Clone to your computer” is the best one and for those using Vs Code it’s as simple as clicking a button. However if you aren't just open up your terminal in your IDE and paste the link on this option and the repository will be cloned to your machine.

Scenario 2: Pushing a cloned repository to Azure Repos

In this scenario you’ll be pushing a cloned repository (from GitHub, GitLab etc.) on your machine to Azure Repos.

To do this you’ll have to open up your cloned project terminal in Vs Code, and configure it from “PowerShell” to “Git Bash”. Then run this code;

$ git remote remove origin

This removes the origin of the previously cloned repository, allowing us to change it to Azure Repos. Running the command provided next sets the new origin to Azure Repos;

with this you’d have successfully pushed the cloned repository to Azure Repos.

Scenario 3: Pushing your local repository to Azure Repos

In this scenario, your codebase is completely in your local machine and hasn’t been cloned from any repository, so what you’ll have to do is run;

$ git init

to initialize git, then this same code;

This will push your repository to Azure Repos. However, you won’t see anything until you commit and publish (Push) the code via you’re IDE. For those using Vs Code this can be done at the Source Control section.

Scenario 4: Importing a repository from GitHub Directly

If you intend on just using a repository that you saw on GitHub or any Git Client without having it cloned to your machine , then this is the best option. All you have to do is click on the import button;


and paste the cloning link from the repository into the space provided and click import;

Conclusion

This article walked you through the process of setting up Azure Repos. It also introduced Azure DevOps and explained how it could benefit you or your organization. The article covered a majority of the scenarios you'll most definitely run into when setting up Azure Repos and how to handle them.

There’s a whole lot to Azure DevOps. In my opinion, it's worth learning, as you can see from the benefits of Azure Repos. And it's also worth considering if you or your organization wants to adopt DevOps or change how you go about it.

AzureGit

Daniel Makhoba Emmanuel

Daniel, a Cloud Engineer, passionately believes that "You can't secure it if you don't know how it's built." He strongly advocates for the adoption of Cloud by individuals and businesses of all scales