← Back to Blog

How to Disable Parallelism in Azure DevOps Pipelines: A Step-by-Step Guide

How to Disable Parallelism in Azure DevOps Pipelines: A Step-by-Step Guide When working with Azure DevOps pipelines , enabling parallelism by default can speed up builds and releases, especially for large projects with many jobs or stages.

How to Disable Parallelism in Azure DevOps Pipelines: A Step-by-Step Guide

When working with Azure DevOps pipelines, enabling parallelism by default can speed up builds and releases, especially for large projects with many jobs or stages. However, there are situations where running tasks in parallel may not be ideal, such as when your pipeline involves shared resources, requires sequential execution, or needs to respect rate limits in external systems.

This post will walk you through the steps to disable parallelism in your Azure DevOps pipelines, giving you more control over your builds.


Why Disable Parallelism? 🤔

Disabling parallelism in a pipeline can be necessary in several scenarios:

  • Shared Resources: Some pipelines may interact with shared resources (e.g., databases, servers), which could cause conflicts when multiple jobs run concurrently.

  • Rate Limiting: External services often have rate limits. Running multiple jobs in parallel can exceed these limits and lead to failed jobs.

  • Sequential Tasks: Some tasks might depend on the completion of others, requiring strict sequential execution.


Steps to Disable Parallelism

Azure DevOps offers a couple of approaches to control parallelism, both at the job and pipeline levels. Here’s how you can do it.


1. Control Parallelism at the Pipeline Level

To ensure the entire pipeline runs sequentially, you can set a limit on the number of jobs that can run in parallel. This is done using the parallel property in the YAML file.

Example:

pool: vmImage: 'ubuntu-latest' # Limit the number of parallel jobs to 1 parallel: 1

By setting parallel: 1, you force the pipeline to run one job at a time. This is useful when your pipeline includes jobs that must run sequentially, such as database migrations or deployments to production.


2. Disable Parallelism for Specific Jobs

You may want to control parallelism at the job level, allowing some jobs to run sequentially while others still run in parallel. This is also configured in the YAML file.

Example:

jobs: - job: Job1 pool: vmImage: 'ubuntu-latest' - job: Job2 dependsOn: Job1 # Job2 will only run after Job1 completes - job: Job3 dependsOn: Job2 # Job3 will only run after Job2 completes

By using dependsOn, you explicitly define the job execution order. This ensures that jobs are executed sequentially, with each one waiting for the previous job to finish.


3. Limiting Parallelism with Resources

Azure DevOps allows you to manage pipeline concurrency by specifying resource limits. You can define how many parallel jobs can use a specific resource (such as a server or environment).

Example:

resources: pipelines: - pipeline: sharedResourcePipeline trigger: none parallel: 1 # Only one job at a time can use this resource

Here, setting parallel: 1 ensures that only one job at a time accesses the shared resource pipeline, which is particularly useful when working with limited infrastructure or databases.


4. Disable Parallelism in Classic UI Pipelines

If you’re using the classic UI to create pipelines, you can control parallelism through pipeline settings:

  • Navigate to the pipeline in Azure DevOps.

  • Click on Pipeline settings.

  • In the settings, set maximum parallel jobs to 1 under the Job settings section.

This setting applies to the entire pipeline, ensuring that all jobs execute one after the other, without parallel execution.


Pros and Cons of Disabling Parallelism

Pros:

  • Ensures that dependent jobs are executed in the correct order.

  • Reduces the chance of conflicts when using shared resources.

  • Helps to avoid exceeding rate limits when interacting with external services.

Cons:

  • Increased build times, as jobs that could have run in parallel now execute sequentially.

  • May reduce the efficiency of pipelines in larger projects where parallelism speeds up the feedback loop.


Conclusion

Disabling parallelism in Azure DevOps pipelines can be essential for maintaining control over the execution order of jobs, especially when dealing with shared resources or dependencies. By using YAML configurations or pipeline settings, you can ensure your pipeline runs smoothly without conflicts.

Experiment with these settings to find the right balance for your workflow, keeping in mind that while disabling parallelism may slow down your pipeline, it can also prevent issues related to resource contention and job dependencies.

Happy building! 💻


Imported from rifaterdemsahin.com · 2025