AZ-400 Practice Question: Design and implement build and release pipelines
Your Azure Pipelines build takes 45 minutes. You want to reduce build time by caching dependencies. Which task should you add to the pipeline?
⚠ Common exam trap
Watch out — candidates often confuse artifact publishing/downloading with caching; candidates often pick PublishBuildArtifacts@1 thinking it caches dependencies, but it only stores build outputs for later use, not intermediate dependency downloads.
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
✓
Cache@2
Cache@2 is the correct task because it allows you to cache dependencies (e.g., npm packages, Maven artifacts) between pipeline runs, significantly reducing build time by avoiding re-downloading unchanged dependencies. This task stores and restores a cache keyed by a hash of the dependency files, enabling incremental builds.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
PublishBuildArtifacts@1
Why it's wrong here
PublishBuildArtifacts@1 uploads build outputs to Azure Pipelines as downloadable artifacts, but it is not a caching mechanism. It cannot store or restore dependencies based on a key, so it does not reduce build time by avoiding re-downloading packages.
- ✗
CopyFiles@2
Why it's wrong here
CopyFiles@2 simply copies files from one location to another within the pipeline, typically to stage outputs. It has no caching logic, no cache key, and no ability to persist or restore dependencies across runs, so it cannot speed up the build.
- ✗
DownloadBuildArtifacts@0
Why it's wrong here
DownloadBuildArtifacts@0 retrieves previously published build artifacts, often used in later stages or releases. It does not cache dependencies used during the build, and it does not provide a restore-from-cache mechanism keyed by dependency files, so it is irrelevant to reducing restore time.
- ✓
Cache@2
Why this is correct
Cache@2 is the dedicated Azure Pipelines task for caching dependencies. It saves a specified folder keyed by a cache key (like a hash of a lock file) and restores it on subsequent runs, which can eliminate repeated package restore operations and significantly reduce build duration, making it the correct solution for a 45-minute build.
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
One of 823 original AZ-400 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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.