stages definition

Stages are a collection of related jobs.

stages: [ stage | template ] # Stages are a collection of related jobs.

Definitions that that reference this definition: pipeline

List types

Type Description
stages.stage A stage is a collection of related jobs.
stages.template You can define a set of stages in one file and use it multiple times in other files.


By default, stages run sequentially. Each stage starts only after the preceding stage is complete unless otherwise specified via the dependsOn property.

Use approval checks to manually control when a stage should run. These checks are commonly used to control deployments to production environments.

Checks are a mechanism available to the resource owner. They control when a stage in a pipeline consumes a resource. As an owner of a resource like an environment, you can define checks that are required before a stage that consumes the resource can start.

Currently, manual approval checks are supported on environments. For more information, see Approvals.


This example runs three stages, one after another. The middle stage runs two jobs in parallel.

- stage: Build
  - job: BuildJob
    - script: echo Building!
- stage: Test
  - job: TestOnWindows
    - script: echo Testing on Windows!
  - job: TestOnLinux
    - script: echo Testing on Linux!
- stage: Deploy
  - job: Deploy
    - script: echo Deploying the code!

This example runs two stages in parallel. For brevity, the jobs and steps are omitted.

- stage: BuildWin
  displayName: Build for Windows
- stage: BuildMac
  displayName: Build for Mac
  dependsOn: [] # by specifying an empty array, this stage doesn't depend on the stage before it

See also

Learn more about stages, conditions, and variables.