Getting Started with Azure DevOps Pipelines

Automate your builds, tests, and deployments with Azure Pipelines.

Welcome to Your First Azure Pipeline

Azure Pipelines is a cloud service that you can use to automate building, testing, and deploying your code to any cloud or on-premises. This guide will walk you through the essential steps to create and run your first pipeline.

What You'll Need

Creating Your First Pipeline

1

Connect to Your Repository

Navigate to your Azure DevOps project, then select "Pipelines" from the left-hand menu. Click "Create Pipeline". You'll be prompted to choose where your code is located. Select your Git provider and authorize Azure DevOps to access your repositories.

Once authorized, select the repository containing your project code.

2

Configure Your Pipeline

Azure Pipelines will analyze your repository and suggest a starter pipeline configuration. For most .NET or Node.js applications, it will detect the appropriate template. You can choose to start with a recommended template or configure it from scratch.

For this tutorial, let's assume you have a simple Node.js application. Select "Starter pipeline" if prompted, or a Node.js template.

3

Understand the YAML Pipeline Definition

Pipelines are defined using YAML. A basic pipeline includes sections for:

  • trigger: When the pipeline should run (e.g., on commits to the main branch).
  • pool: The agent pool where the job will run.
  • steps: A sequence of tasks to execute.

Here's an example of a simple Node.js pipeline:

trigger:
- main

pool:
  vmImage: 'ubuntu-latest'

steps:
- task: NodeTool@0
  inputs:
    versionSpec: '18.x'
  displayName: 'Use Node.js 18.x'

- script: |
    npm install
    npm run build
  displayName: 'Install dependencies and build'

- script: |
    npm test
  displayName: 'Run tests'
  condition: succeeded() 
4

Save and Run Your Pipeline

Once you've reviewed or customized your YAML file, click "Save and run". You can commit the YAML file directly to your repository or save it as a pull request. Azure Pipelines will then start executing the defined steps.

Monitor the pipeline's progress in the "Pipelines" section. You can view logs for each step to troubleshoot any issues.

You can view the full YAML schema and available tasks in the Azure DevOps documentation.

Next Steps

Congratulations! You've created and run your first Azure Pipeline.