Courseiva
hardMultiple ChoiceObjective-mapped

AZ-400 Practice Question: A company uses Azure Pipelines to build a .NET…

A company uses Azure Pipelines to build a .NET Core application. The build takes 45 minutes due to dependency restoration. They want to reduce build time. What is the most effective strategy?

⚠ Common exam trap

Many candidates confuse 'parallel jobs' or 'faster agents' with solving a network-bound dependency restoration problem, when caching is the only strategy that eliminates the repeated download of unchanged packages.

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 the NuGet packages and enable caching in the pipeline

Caching NuGet packages in Azure Pipelines is the most effective strategy because dependency restoration is the primary bottleneck, often downloading hundreds of packages from nuget.org. By caching the ~/.nuget/packages folder, subsequent builds skip the network download entirely, reducing the 45-minute build time to minutes. This directly addresses the root cause—repetitive package restoration—without requiring additional infrastructure or parallelism.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Cache the NuGet packages and enable caching in the pipeline

    Why this is correct

    The `DotNetCoreCLI`/`NuGetCommand` task with caching uses a cache key derived from the NuGet.config and the project files (or the packages.lock.json), and stores the global packages folder (`~/.nuget/packages`) on the Azure DevOps server. On a cache hit, `dotnet restore` can satisfy package references from the local cache rather than downloading them, cutting restore time from tens of seconds to near zero. The cache is restored to the agent workspace at job startup, so it works across pipeline runs even on hosted agents, which are ephemeral. This directly addresses the network bottleneck that caused the slow builds.

  • Use parallel jobs in the pipeline

    Why it's wrong here

    Parallel jobs (or parallel pipeline runs) distribute independent pieces across multiple agents to run simultaneously; they can improve throughput when there are many independent jobs, but they do not accelerate the execution of a single linear build. In a typical .NET Core build, the steps (restore, build, test, publish) are sequential and depend on each other; splitting them into parallel jobs would either require complex multi-job orchestration or duplicate work, and the restore step would still download the same packages from NuGet on every agent. Consequently, wall-clock time for a single pipeline run remains dominated by the same network-bound package restore.

  • Use a self-hosted agent with more CPU

    Why it's wrong here

    A self-hosted agent with additional CPU cores accelerates CPU-bound steps like compilation and packaging, but the observed build time is dominated by network latency and bandwidth when downloading NuGet packages from external feeds. Upgrading the CPU does not increase network throughput or eliminate the need to fetch packages; the restore step will still wait on the same network I/O. Even with a faster processor, MSBuild's restore phase is I/O bound, and compilation is a comparatively small fraction once packages are available. Therefore, this option would not meaningfully reduce overall build duration.

  • Enable incremental builds

    Why it's wrong here

    Incremental builds (via MSBuild's up-to-date checks or specifying `--no-restore` after a preceding restore) avoid recompiling unchanged projects, but the pipeline's slow stage is the `dotnet restore` that resolves and downloads NuGet packages from the network. Even if compilation is skipped entirely, the restore step must still query the package source and download the .nupkg files from scratch on every new agent or when the cache does not exist; incremental compilation does nothing to avoid that network fetch. The packages are typically the same each time, so an incremental build cannot reduce the time spent waiting on package acquisition.

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 →

How Courseiva writes practice questions · Editorial policy

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.