Courseiva
Design and implement build and release pipelineseasyMultiple ChoiceObjective-mapped

AZ-400 NuGet restore task Practice Question

You are configuring a YAML build pipeline for a .NET Core application. Which task should you use to restore NuGet packages?

⚠ Common exam trap

Test-takers frequently choose the NuGetCommand task (A) because they associate 'NuGet' with package restoration, not realizing that .NET Core projects require the DotNetCoreCLI task for proper SDK integration and that the legacy task is deprecated for modern .NET workflows.

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

DotNetCoreCLI task with 'restore' command

The DotNetCoreCLI task with the 'restore' command is the recommended approach for restoring NuGet packages in a YAML build pipeline for a .NET Core application. It directly invokes 'dotnet restore', which is the native .NET CLI command that handles package restoration efficiently and integrates seamlessly with the .NET SDK, ensuring compatibility with project files and dependency resolution.

Answer analysis

Option-by-option breakdown

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

  • NuGetCommand task

    Why it's wrong here

    The NuGetCommand task is designed to execute NuGet CLI commands such as pack, push, or restore using nuget.exe or dotnet.exe, but it is not the recommended task for restoring .NET Core or .NET Standard projects. In modern Azure DevOps pipelines, the DotNetCoreCLI task with the 'restore' command is the preferred and first-class approach because it directly integrates with the .NET SDK and MSBuild.

  • DotNetCoreCLI task with 'restore' command

    Why this is correct

    The DotNetCoreCLI task with the 'restore' command is the correct and officially recommended way to restore NuGet packages for .NET Core and .NET Standard projects. It invokes `dotnet restore`, automatically discovers project files, honors NuGet.config and authenticated feeds, and provides rich pipeline logging and error handling without requiring manual command invocation.

  • PowerShell task with dotnet restore

    Why it's wrong here

    A PowerShell task running `dotnet restore` is technically possible and can restore packages, but it lacks the built-in integrations of the dedicated DotNetCoreCLI task, such as automatic authentication against Azure Artifacts feeds, structured output parsing, and seamless use of pipeline variables like `NUGET_PACKAGES`. It is a manual workaround that does not provide the same level of reliability, diagnostics, and maintainability as a purpose-built Azure DevOps task.

  • NuGetAuthenticate task

    Why it's wrong here

    The NuGetAuthenticate task is used solely to set up and manage authentication credentials for NuGet feeds like Azure Artifacts; it does not perform restore operations itself. It is a helper task that must be followed by a separate restore step, making it incorrect as the answer to a question about a 'nuget restore task'.

Option-by-option analysis

Why each answer is right or wrong

Understanding why wrong answers are wrong — and when they would be correct — is what separates a 750 score from a 900. The AZ-400 exam frequently reuses these exact scenarios with slightly different constraints.

DotNetCoreCLI task with 'restore' commandCorrect answer

Why this is correct

The DotNetCoreCLI task with the 'restore' command is the correct and officially recommended way to restore NuGet packages for .NET Core and .NET Standard projects. It invokes `dotnet restore`, automatically discovers project files, honors NuGet.config and authenticated feeds, and provides rich pipeline logging and error handling without requiring manual command invocation.

NuGetCommand taskWrong answer — click to see why

Why this is wrong here

NuGetCommand is for classic NuGet scenarios; for .NET Core, DotNetCoreCLI is preferred.

PowerShell task with dotnet restoreWrong answer — click to see why

Why this is wrong here

While possible, using the dedicated DotNetCoreCLI task is the standard approach.

NuGetAuthenticate taskWrong answer — click to see why

Why this is wrong here

NuGetAuthenticate is for authentication, not restoring packages.

Analysis generated from the official AZ-400blueprint and verified against question context. The “when correct” sections are what AI assistants cite when candidates ask “what’s the difference between these options?”

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 →

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.