Build a repo using the visual designer
We recommend that you use YAML instead of the visual designer that is explained below. YAML allows you to use the same branching and code review practices for your pipeline as you would for your application code. See Create your first pipeline.
- You need an Azure DevOps organization. If you don't have one, you can create one for free. If your team already has one, then make sure you're an administrator of the Azure DevOps project that you want to use. (An Azure DevOps organization is different from your GitHub organization. Give them the same name if you want alignment between them.)
- You need a GitHub account, where you can create a repository.
Get the sample code
Azure Pipelines can be used to build an app written in any language. For this guide, we will use a .NET Core sample app. Fork the following repository into your own GitHub account.
You should now have a sample app in your GitHub account.
Set up CI for your repository
Follow the steps below to configure GitHub as a source for your Azure Pipelines build.
Login to your organization in Azure DevOps and navigate to your project.
In your project, navigate to the Pipelines page, and then choose New pipeline.
Select GitHub for the type of repository.
Give your connection a name, and then select the Authorize using OAuth button. Optionally you can use a GitHub personal access token instead of OAuth.
When prompted, sign in to your GitHub account. Then select Authorize to grant access to your organization. If you already are signed into GitHub in another browser tab, you may not see this step.
Choose the repository that contains the sample you forked earlier and select Continue.
Select the ASP.NET Core build template or a template that is appropriate for your application.
Choose Hosted Ubuntu 1604 for Agent pool.
Select Triggers. Enable Continuous integration for your builds. Ensure you include the
masterbranch under Branch filters. This setting ensures each commit to
masterin GitHub will trigger a build via a GitHub webhook.
Select Save & queue to save your build pipeline and create the first build.
Once the build completes, select the name of the pipeline in the build results page to navigate to the history of builds for that pipeline. Take a note of the
definitionIdin the URL. You will need this to set up the build badge in upcoming steps.
Get the status badge
In the Azure Pipelines page, navigate to the list of pipelines.
Select the pipeline that was created for you.
In the context menu for the pipeline, select Status badge.
Copy the sample markdown from the status badge panel.
Add a status badge to your repository
Select the Readme.md file, and then choose Edit.
Copy the status badge Markdown that you copied in the previous section at the beginning of the readme.md file.
Commit the change to the master branch.
Notice that the status badge appears in the description of your repository.
In Azure Pipelines:
- Observe that a new build is queued; its status could be either not started or running.
Q & A
How do I use a personal access token to authorize the Azure Pipelines to GitHub connection?
See this article for creating a GitHub personal access token. You can use the token in the Azure Pipelines Get sources task of your build or release pipelines by creating a GitHub service connection and entering the token.