Skip to content
Latchkey

How to Run Parallel Jobs in Azure Pipelines

Jobs without dependencies run in parallel automatically, bounded only by your parallel-jobs quota.

List multiple jobs in a stage with no dependsOn between them and they fan out. Use strategy.parallel to slice one job into N agents for sharded work.

Independent jobs and a sliced job

Lint and Test run in parallel; the Shard job runs 4 copies you split by index.

azure-pipelines.yml
jobs:
  - job: Lint
    steps: [{ script: npm run lint }]
  - job: Test
    steps: [{ script: npm run test:unit }]
  - job: Shard
    strategy:
      parallel: 4
    steps:
      - script: npm test -- --shard=$(System.JobPositionInPhase)/$(System.TotalJobsInPhase)

Gotchas

  • Concurrency is capped by your purchased parallel jobs; excess jobs queue.
  • With strategy.parallel, use System.JobPositionInPhase / System.TotalJobsInPhase to shard work yourself.
  • Parallel jobs each get a fresh agent - share results via pipeline artifacts, not the filesystem.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →