DEV Community

Cover image for Configure Azure Pipelines app in ghe.com
Jesse Houwing
Jesse Houwing

Posted on Originally published at jessehouwing.net on

Configure Azure Pipelines app in ghe.com

I recently helped a client migrate from Azure DevOps to GitHub Enterprise Managed Users with Data Residency (ghe.com for short). And as part of the migration we rewired the exiting Azure Pipelines from the old repository located on Azure Repos to the new one on GitHub.

With GitHub Enterprise this is quite easy, create a new service connection in Azure DevOps and click the magic authorize button to install the app into GitHub automatically. Unfortunately no such luck in ghe.com, even though there is a special service connection type:

Configure Azure Pipelines app in ghe.com
Select the GitHub Enterprise Cloud with data residency service connection type to link Azure Pipelines with ghe.com

The screen mentions: "GitHub Organization should have azure pipelines app already installed", but there is no documentation anywhere on how to actually do that.

Configure Azure Pipelines app in ghe.com
Unfortunately, this already expects the Azure Pipelines app to be installed in the target GitHub organization

And unfortunately, it turned out we weren't the first to hit this snag. And the error message is not very helpful either:

Configure Azure Pipelines app in ghe.com
The error message you receive is "Could not complete OAuth Authorization; verify you have enough permissions to perform this operation"

I reached out to my contacts in GitHub and Azure DevOps to see if they knew what to do, but unfortunately, even they did not know.

I decided to play around some more and stumbled upon this well hidden url based on the url of the Azure Boards app by replacing boards with pipeline

https://{enterprise-slug}.ghe.com/apps/external-app/azure-boards
https://{enterprise-slug}.ghe.com/apps/external-app/azure-pipelines
Enter fullscreen mode Exit fullscreen mode

And lo and behold, from this location you can install the Azure Pipelines app:

Configure Azure Pipelines app in ghe.com
By navigating directly to the hidden Azure Pipelines GitHub App installation page you can install the app

Click Install to and select your GitHub organization, after which the configuration of the service connection will work without a hitch:

Configure Azure Pipelines app in ghe.com
Select the GitHub Organization you want to link to your Azure DevOps Project.

Select the repos you want to enable for Azure Pipelines:

Configure Azure Pipelines app in ghe.com
Select which repos in GitHub should be available to Azure Pipelines

After which you are redirected to Azure DevOps to complete the installation:

Configure Azure Pipelines app in ghe.com
Select the correct Azure DevOps organization and project

If you now go back into the settings of your Azure DevOps Project, you should be able to create the new service connection:

Configure Azure Pipelines app in ghe.com
Create the new service connection, which should work without any issues.

Click Authorize after which you'll be able to Save the new service connection.

To rewire a pipeline, navigate to the pipeline you want to rewire and click Edit :

Configure Azure Pipelines app in ghe.com
Edit your existing Azure Pipelines Definitions to rewire them to GitHub

Click the button and then select Triggers:

Configure Azure Pipelines app in ghe.com
Use the triggers editor to navigate to the classic Pipelines editor

This brings you to the classic pipelines editor on which you can navigate to the YAML tab:

Configure Azure Pipelines app in ghe.com
In the classic Pipelines editor, navigate to the YAML tab to change the source location

Select the Get Souces element in the pipeline

Configure Azure Pipelines app in ghe.com
Select the Get Sources step to rewire the pipeline to GitHub

And rewire the pipeline to GitHub by selecting the GitHub tile and picking the Service Connection we previously created:

Configure Azure Pipelines app in ghe.com
After selecting GitHub, change the service connection, repository and default branch

Top comments (0)