We all probably know by now that there is some pretty solid first-party support for linking GitHub to Azure DevOps, specifically, Azure Boards, with the Azure Boards GitHub app. Assuming you have the right permissions, the setup is straight forward. When going through and setting up the GitHub app, you’ll pick the Azure DevOps organization and project that you want to link to.
And this works great - however, what isn’t as clear, what if you have a GitHub organization that you want to link to multiple Azure DevOps Projects or Organizations? Going through the Azure Boards installation process only allows you to select a single Azure DevOps Organization and linking to a single Project. Unless your team is following the One Project to Rule Them All strategy, you start to realize that this might not be a very tenable solution. The documentation seems to indicate that connecting our GitHub organization to more than one Azure DevOps organization is not recommended (nor possible).
After a little playing around, here are the steps that I followed in order to satisfy our scenario of linking our GitHub organization to multiple Azure DevOps organizations with the Azure Boards GitHub app:
- Install the Azure Boards app to your GitHub org - select the Azure DevOps Org #1 organization that you want to link to as well as what GitHub repo(s) to link to
- Navigate to the GitHub organization –> Settings –> Installed GitHub Apps –> Azure Boards and make a change (ie select a new repo) and click ‘Save’
- If you had selected ‘All repositories’ in step #1, you will have to select ‘Only select repositories’ instead and select the repos by hand to be able to click ‘Save’ on this page
- Link it to Azure DevOps Org #2
- For each of the Azure DevOps organizations, navigate to the project –> project settings –> GitHub Connections to verify the repo mappings are correct - add/remove GitHub repositories if necessary
Now you have a single GitHub organization linked to multiple Azure DevOps organizations!
Here it is in action - I created a commit in each repository in GitHub. They both happen to link to
AB#1 since these are both new Azure DevOps organizations and this was the first work item I created in each. I also wanted to prove that there wouldn’t be any conflicts of the links that are created.
Azure DevOps Org #1 linked to GitHub repo A
Azure DevOps Org #2 linked to GitHub repo B
Note that 1 GitHub repo would only be linked to 1 AzDO org/project at a time though - if you try to link a GitHub repo to more than 1 AzDO org, you get a fun
nullerror message: null error message trying to add an already-linked GitHub repository
- If you don’t see your GitHub org in the Azure DevOps project settings –> GitHub Connections when adding/removing GitHub repositories, try launching an incognito window to re-force the GitHub authentication flow to be able to authenticate to another GitHub repo
- We once saw that the GitHub connection was disabled, but we think that was after trying to create a new GitHub connection from a new Azure DevOps org directly in Azure DevOps without first going through GitHub - if this happens, you should be able to manually re-enable the GitHub connection
GitHub works best when using a single org model. If you wanted to use the Azure Boards integration to link to multiple Azure DevOps organizations, you might be displeased at first after reading the documentation - but hopefully the steps in this article will help you configure the integration properly!