Create your first pipeline

Azure Pipelines

This is a step-by-step guide to using Azure Pipelines to build a GitHub repository.

Prerequisites

  • 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

You can use Azure Pipelines to build an app written in any language. Select a sample repository of your choice from the following languages and fork it into your own GitHub user account:

Programming language Repository with a sample app
.NET Core https://github.com/MicrosoftDocs/pipelines-dotnet-core
Go https://github.com/MicrosoftDocs/pipelines-go
Java https://github.com/MicrosoftDocs/pipelines-java
Node.js https://github.com/MicrosoftDocs/pipelines-javascript
Python https://github.com/MicrosoftDocs/pipelines-python-django

You should now have a sample app in your GitHub account.

Get your first build

  1. Sign in to your Azure DevOps organization and navigate to your project.

  2. In your project, navigate to the Pipelines page. Then choose New pipeline.

  3. Walk through the steps of the wizard by first selecting GitHub as the location of your source code.

    Select GitHub

  4. For the second step, choose to Authorize with OAuth by selecting Authorize. You might be redirected to GitHub to sign in. Enter your GitHub credentials.

  5. When you're redirected back to Azure Pipelines, select the sample app repository.

  6. For the third step, Azure Pipelines analyzes the code in your repository. If your repository already contains an azure-pipelines.yml file, which is the case for all sample repositories, then this step is skipped. Or else, Azure Pipelines recommends a starter template based on the code in your repository.

  7. In the final step, you're shown the YAML file that will be used.

  8. Select Save and run. Choose the option to Commit directly to the master branch.

  9. The YAML file is now pushed to your GitHub repository, and a new build is automatically started.

  10. Wait for the build to finish.

Get the status badge

  1. In Azure Pipelines, go to the Build page to view the list of pipelines.

  2. Select the pipeline that was created for you.

  3. In the context menu for the pipeline, select Status badge.

    Status badge

  4. Copy the sample Markdown from the status badge panel.

Add the status badge to your repository

Take the following steps in GitHub:

  1. Inspect the azure-pipelines.yml file at the root of your repository. The YAML file contains the instructions for the pipeline. The next time you change any file in this repository, Azure Pipelines will automatically build your code.

  2. Go back to the list of files and select the Readme.md file. Then choose Edit.

  3. Copy the status badge Markdown that you copied in the previous section at the beginning of the Readme.md file.

  4. Commit the change to the master branch.

  5. Notice that the status badge appears in the description of your repository.

Back in Azure Pipelines, observe that a new build is queued. Its status might be either not started or running.

Next steps

You've just learned the basics of using Azure Pipelines. Now you're ready to further configure your pipeline to run tests, publish test results, create container images, or even deploy the app to a cloud service. Follow a track for the language of your choice:

To adjust the timeout of your job, see Timeouts.

To run your pipeline in a container, see Container jobs.

For details about building GitHub repositories, see Build GitHub repositories.