AZ-400 Practice Question: Design and implement build and release pipelines
Which TWO of the following are valid strategies to reduce the build time of a container image in Azure Pipelines?
⚠ Common exam trap
The trap is that candidates often assume combining RUN commands (Option A) always reduces build time, but it can harm cache efficiency. Another is assuming that parallelizing multiple images (B) affects the build time of a single image; it does not.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Use Docker layer caching with a registry cache.
The correct strategies to reduce build time for a container image in Azure Pipelines are using Docker layer caching with a registry cache (C) and using a larger build agent with more CPU cores (E). Layer caching avoids rebuilding unchanged layers, while a larger agent provides more parallelism for CPU-bound build steps. Combining RUN commands (A) can hurt cache efficiency and is not a reliable way to reduce build time. Building multiple images in parallel (B) reduces overall pipeline time when you have multiple images, but it does not reduce the build time of a single image. Disabling security scanning (D) is not a valid practice.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Combine multiple RUN commands into a single RUN instruction to reduce layers.
Why it's wrong here
Combining multiple RUN commands into a single instruction reduces the number of image layers, which can decrease image size and pull time, but it does not directly speed up the build because all operations still execute sequentially. Moreover, with layer caching enabled, separate RUN commands can cache intermediate layers, so merging them may actually reduce cache hit rates and slow down iterative builds.
- ✗
Build multiple images in parallel using matrix strategy.
Why it's wrong here
Building multiple images in parallel using a matrix strategy is a valid optimization because it runs independent image builds concurrently as separate jobs, rather than sequentially. This reduces the overall wall-clock time of the pipeline, especially when the images have different base images, architectures, or configuration variants that do not depend on each other.
- ✓
Use Docker layer caching with a registry cache.
Why this is correct
Using Docker layer caching with a registry cache is a valid strategy because it reuses previously built and stored layers from a container registry (e.g., ACR) instead of rebuilding unchanged steps. This dramatically accelerates builds, particularly in CI/CD pipelines with frequent commits or shared base layers, as only the modified layers are rebuilt and the rest are pulled from cache.
- ✗
Disable security scanning for the image.
Why it's wrong here
Disabling security scanning for the image is not a valid strategy to reduce build time because scanning is a post-build analysis step that does not affect the Docker build process itself. Additionally, disabling scanning exposes the pipeline to unresolved vulnerabilities and violates security best practices, making it an unacceptable trade-off.
- ✓
Use a larger build agent with more CPU cores.
Why this is correct
Using a larger build agent with more CPU cores is not guaranteed to reduce build time because Docker builds are often constrained by I/O, network latency, layer packing, and other bottlenecks that are not fully resolved by adding CPU capacity. Without optimizing the build pipeline (e.g., enabling BuildKit parallel stages or efficient caching), increased agent size may yield minimal improvement and higher cost.
Go deeper
Related to this question
Learn chapter
Introduction to DevOps and Azure DevOps
Key term
Pipeline
A pipeline is an automated series of steps that takes code from development to production, ensuring quality and speed.
Key term
Azure Pipelines
Azure Pipelines is a cloud-based CI/CD service from Microsoft that automatically builds, tests, and deploys code to any platform or cloud.
About these practice questions
Courseiva writes every AZ-400 question from scratch — 823 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This AZ-400 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the AZ-400 exam.