AZ-400: Designing and Implementing Microsoft DevOps Solutions

Design and Implement Pipelines

Understanding Build Agents and Parallelism

Azure Pipelines—part of Azure DevOps—provides a scalable CI/CD platform for modern applications. At its core are Build Agents, which execute your pipeline tasks, and Parallelism, which speeds up your workflows. In this guide, we’ll cover how build agents work, how to configure them, and how to leverage parallel jobs for faster delivery.

Typical Build and Deploy Workflow

A Build Agent executes each stage of your CI/CD pipeline:

  1. Pipeline Trigger
  2. Checkout Source Code
  3. Run Build and Tests
  4. Publish Build Artifacts
  5. Package Artifacts (e.g., container images)

Note

Automating these steps ensures consistent, repeatable deployments and reduces manual overhead.

The image is a flowchart illustrating a build pipeline process, showing the sequence from starting the pipeline to creating a container image using pipeline jobs and artifacts.

Core Functions of a Build Agent

Build Agents are responsible for:

  • Cloning repositories (Git, TFVC, etc.)
  • Executing build scripts (MSBuild, Maven, npm, etc.)
  • Running automated tests
  • Publishing artifacts to Azure Artifacts, GitHub Packages, or external feeds
  • Deploying to target environments via tasks (e.g., ARM, Kubernetes)

These tasks make agents the backbone of your CI/CD pipeline.

Hosted vs. Self-Hosted Agents

Choose the right agent type based on your control, cost, and compliance needs:

Agent TypeDescriptionWhen to Use
Hosted AgentMicrosoft-managed with preinstalled tools and OS imagesQuick start, no infrastructure overhead
Self-Hosted AgentCustomer-managed on VMs or on-prem serversCustom dependencies, specific network access, cost optimization

The image is a diagram showing the types of build agents, illustrating the deployment of self-hosted agents using an Azure Pipeline and AKS Cluster, with three agents running pipelines.

Configuring Build Agents

  1. Define Agent Pools
    Use agent pools to group agents by environment or capability.
  2. Install and Update Agents
    For self-hosted agents, follow the Agent installation guide and keep the agent software updated.
  3. Assign Permissions
    Configure pool security to restrict who can queue pipelines or manage agents.

The image is a presentation slide about configuring build agents, showing a menu from Azure DevOps with a focus on "Agent pools" and a list of agent pool names. It also includes a color-coded list of topics: basic setup steps, agent pools, and managing agent versions.

Enabling Parallelism

Parallel jobs run multiple pipeline stages or tasks at the same time, cutting down total execution time:

  • Sequential: A → B → C
  • Parallel: A, B, and C run concurrently

The image is a flowchart illustrating the benefits of parallelism in Azure Pipelines, showing stages like "Starting point," "Stage Component A/B/C," "Produce artifacts," and "Deploy application," with a skipped "Rolling back" stage. It highlights reduced execution time for CI/CD processes.

Warning

Check your Azure DevOps plan for the number of parallel jobs included. Exceeding this limit will queue additional jobs and delay execution.

Best Practices for Parallel Builds

  • Distribute test suites across multiple agents.
  • Define dependencies with dependsOn in YAML pipelines.
  • Use a matrix strategy to run combinations of environments in parallel:
strategy:
  matrix:
    linux-node:
      OS: ubuntu-latest
      NODE_VERSION: 14
    windows-node:
      OS: windows-latest
      NODE_VERSION: 14
  • Monitor job durations to identify bottlenecks.

Optimizing Build Agents and Parallelism

Continuous improvement is key:

  • Monitoring and Scaling
    Integrate with Azure Monitor to track agent performance and scale pool size dynamically.
  • Efficient Resource Allocation
    Right-size VM SKUs for self-hosted agents; deallocate idle VMs when not in use.
  • Review and Refine
    Regularly audit pipeline definitions, update agent versions, and tweak parallel strategies based on data.

The image is a slide titled "Optimizing Build Agents and Parallelism," featuring three colored boxes labeled "Monitoring and scaling," "Efficient resource allocation," and "Continuous improvement."

Watch Video

Watch video content

Previous
Exploring YAML Pipelines