nerdexam
MicrosoftMicrosoft

AZ-500 · Question #636

AZ-500 Question #636: Real Exam Question with Answer & Explanation

The correct pipeline configuration uses $(Agent.Id) as the cache key prefix to scope the cache to a specific agent, combined with $(Build.SourcesDirectory)/**/packages.lock.json as the lock file path to invalidate the cache when dependencies change. The 'nuget' value is used for

Submitted by fatema_kw· Mar 6, 2026Design and implement a package management strategy - Configure pipelines to cache dependencies to improve build performance using the Cache task with appropriate key expressions and target paths for NuGet packages.

Question

Drag and Drop Question You use an Azure pipeline to build a .NET app that has NuGet dependencies. You need to ensure that the pipeline caches required NuGet packages. How should you configure the pipeline? To answer, drag the appropriate values to the correct targets. Each value may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content. NOTE: Each correct selection is worth one point. Answer:

Explanation

The correct pipeline configuration uses $(Agent.Id) as the cache key prefix to scope the cache to a specific agent, combined with $(Build.SourcesDirectory)/**/packages.lock.json as the lock file path to invalidate the cache when dependencies change. The 'nuget' value is used for both the cache task identifier/alias and the path hint, while $(NuGet_PACKAGES) specifies the actual directory where NuGet packages are stored on the agent - this is the standard environment variable pointing to the global NuGet packages folder that the Cache task should restore to and save from.

Topics

#Azure Pipelines#NuGet Caching#Pipeline Cache Task#Build Optimization

Community Discussion

No community discussion yet for this question.

Full AZ-500 PracticeBrowse All AZ-500 Questions