How to Link Azure Boards with GitHub Commits and Pull Requests

TL/DR: When using Azure Boards to track work items, these work items can be linked to GitHub commits and pull requests. When doing so, updates to the pull requests are also noted in the work item. Once the pull request has been merged, the Azure Boards work item automatically resolved. For detailed information, see the GitHub and Azure Boards documentation.

Quick and fun blog post with lots of pictures for today. The scenario is that my organization, let's call them Tailwind Traders, stores Azure Templates in GitHub and have a nightly Azure Pipelines build to lint and ensure proper configuration of these templates. Recently these builds started failing.


So, we are going to need to but first I will create an Azure Boards bug so that we can track the work.


Connect Azure Boards to GitHub

Before and potentially fixing the template issue. Let's link the Azure project to our GitHub repository. To do so, navigate to the project settings and select GitHub Connections and follow the on-screen prompts.

For more information on this operation, see Connect Azure Boards to GitHub


Fix template and create a pull request

Now that we have a. identified the issue and b. linked the Azure project with GitHub, we can begin to work the issue.

I am going to first move the work item from the new column to the Active column to signal to my team that I am working the issue. This also sets the state of the work item to Active.


Looking at the Azure template, I see that a simple comma is missing which has invalidated the template. I've added the comma and created a pull request for the fix. Take note here of the commit message. I've added to the message Fixes: AB#34. This string of text here will link this commit and PR to the Azure Boards work item.

For more information on this operation, see Link GitHub commits and pull requests to work items.


Because we have continuous integration and pull request validation enabled in our Azure project, I can see directly in the pull request that a build has been triggered to validate proper configuration of that Azure template.


I can also see the build in Azure DevOps itself.


What is really cool is that because I have created the link between my Azure DevOps project and GitHub and have used the correct strings in my commit message, all GitHub activity is now logged to the Azure Boards work item.


Merge pull request and close bug

Once the build has completed successfully, someone from my team will validate my work and merge the pull request. Because of the link between Azure Boards and GitHub account not only will the merge operation be logged to the Azure Boards work item:


the work item is also automatically is resolved.


That was super fun to work through. Feel free to reach out in comments or on Twitter @nepeters.


This article was originally published by Microsoft's Azure Blog. You can find the original article here.