Now that Microsoft owns GitHub, you may be wondering whether your teams should use GitHub or Azure DevOps for their software development projects. Why not both?
Latest posts by Timothy Warner (see all)

Does your organization practice DevOps? If so, do they use Microsoft Azure DevOps Services, the cloud-hosted software development platform? Or, alternatively, do your teams use GitHub?

Microsoft's DevOps solution landscape has been more than a bit confusing, to be honest. First, consider Azure DevOps Services. This product has had so many names over the past several years:

  • Visual Studio Team Services
  • Visual Studio Online
  • Team Foundation Service Preview

Then there's the local, on-premises product currently known as Azure DevOps Server, but which was once called Team Foundation Server (TFS) and Visual Studio Team System.

Add to this confusion Microsoft's acquisition of GitHub in June 2018. Of course, the natural question for DevOps teams is, "Is Microsoft going to deprecate Azure DevOps in favor of GitHub?"

My friends at Microsoft told me they plan to support both Azure DevOps and GitHub long into the foreseeable future. However, any innovation will happen at GitHub first. This point makes sense when you see new-ish GitHub products such as Actions and Packages pop up.

Anyhow, this question isn't necessarily an either/or one, but rather a both/and. GitHub and Azure DevOps each have their respective strengths and weaknesses. Once you begin digging into them, you'll find many opportunities for integration. In today's lesson, I'll explain two of them. Let's get started!

Integrate GitHub with Azure Repos

First, let's learn how to transition an existing public or private GitHub repository to Azure Repos. You may be familiar with the GitHub flow concept, in which we can fork somebody else's GitHub project into our own GitHub account, and then "own" that fork.

In this example, let's assume we want no ongoing connection between our "old" GitHub repo and our "new" Azure Repos one. To set up this integration, you'll need to meet the following prerequisites:

  • GitHub account
  • Microsoft Azure subscription
  • Azure DevOps organization and project
  • Service connection to Microsoft Azure

From the Azure Repos in your empty project, we can either clone (copy) the GitHub repository to Azure Repos, or we can perform an import. We would clone if we wanted to push Azure Repos code commits to GitHub.

For our purposes, we'll do an import. I summarize the steps in the following screen capture.

Import a GitHub repo into an Azure Repos

Import a GitHub repo into an Azure Repos

In this article, I'm using one of the GitHub sample repos (a Node.js calculator app). You can use whatever public or private GitHub repo you want. Note the Requires Authentication option; you'd use this for private repos.

Now that a copy of the GitHub repository resides in Azure Repos, you can provide the clone URL to your team members so they can work with the codebase locally. I show you this process in the following screenshot.

Share the Azure Repos clone URL 1

Share the Azure Repos clone URL 1

NOTE: This tutorial is not intended to be comprehensive. I suggest you seek training to get up to speed on related concepts if you need them. Some keywords to search for are git basics, GitHub flow, git clone vs fork, Azure DevOps user accounts, and GitHub flow.

Integrate GitHub with Azure Pipelines

One of the hallmarks of DevOps in general and Azure DevOps in particular is the possibility of creating a fully or partially automated application/infrastructure build and release process.

For example, we can store not only our application's source code in our Azure Repos repository, but also the accompanying Azure infrastructure (in the form of Azure Resource Manager JSON templates) and even a pipeline YAML file.

In the next integration, we'll fork the calculator app into our GitHub account and then set up a continuous integration (CI) build pipeline in Azure DevOps.

The idea is that every time you or a colleague makes a commit to the main branch in your GitHub fork, Azure Pipelines will run an automated build process for the application. You then can use Azure Pipelines to create a continuous deployment (CD) pipeline to place the app on actual running infrastructure.

Again, I'm working at a high abstraction level in today's lesson. Microsoft published a step-by-step walkthrough of this process; I encourage you to check it out.

In the next composite screenshot, you can see me forking GitHub's calculator sample app to my own GitHub account. The advantage of forking is that we may not have contributor access to the original repo. By forking, we can make changes and optionally submit these changes to the upstream repository's for possible merge. GitHub calls this merge request/review/approval process a pull request.

Fork GitHubs repo to my GitHub account

Fork GitHubs repo to my GitHub account

Our next task is to install the Azure Pipelines tool from the GitHub Marketplace. You'll need to go through a few OAuth2 consent screens and sign into your Azure DevOps organization and project with proper credentials.

Install the Azure Pipelines tool in GitHub

Install the Azure Pipelines tool in GitHub

Once you link the GitHub Azure Pipelines tool to your target Azure DevOps project, you'll wind up with an Azure Pipelines YAML build definition that is triggered on GitHub repo-based code commits. Here's an example:

Our Azure Pipelines build definition

Our Azure Pipelines build definition

  • A: Azure DevOps stores your build and release pipelines under Pipelines > Pipelines.
  • B: Note that in this example, both the pipeline YAML and our application source code are in GitHub. Of course, you can create Azure Pipelines based on code in Azure Repos.
  • C: Here, we specify which branch is tied to triggering the automated build process.
  • D: Azure DevOps runs hosted VMs to execute your CI pipeline. One of Azure DevOps' value propositions is that you don't have to host your own build servers locally.
  • E, F: This simple pipeline first installs Node.js and any application-specific dependencies. Of course, you'll have different task steps depending on your application's technology stack.

NOTE: Once again, this is a high-level tutorial. You may need to adjust the visibility of your Azure DevOps projects if you're working with public GitHub repositories. Some keywords you can search for to learn more include GitHub public vs private projects, Azure DevOps public vs private projects, GitHub identity, Azure DevOps identity, Azure Pipelines docs.

In the following screenshot, you can see me monitoring my Azure Pipelines build process in the Azure DevOps portal.

Monitor the Azure Pipelines CI process

Monitor the Azure Pipelines CI process

Wrap-up

I know it sounds clichéd, but we truly have only scratched the surface regarding how many GitHub-Azure DevOps integration possibilities exist. Some other integrations I suggest you try are:

Subscribe to 4sysops newsletter!

1 Comment
  1. Gary 2 years ago

    WoW, Tim to the rescue again!  I was having trouble with one of the Microsoft DevOpsLabs on how to do this very thing, and so I google'd for some more help … this site popped up!  Good advice, thanks again.  You are everywhere helping everyone!

Leave a reply

Your email address will not be published. Required fields are marked *

*

© 4sysops 2006 - 2023

CONTACT US

Please ask IT administration questions in the forums. Any other messages are welcome.

Sending

Log in with your credentials

or    

Forgot your details?

Create Account