nerdexam
Microsoft

AZ-400 · Question #437

Drag and Drop Question You have an Azure DevOps pipeline that is used to deploy a Node.js app. You need to ensure that the dependencies are cached between builds. How should you configure the deployme

The correct answer is npm install; ne(variables.CACHE_RESTORED, 'true'). When caching dependencies in Azure DevOps pipelines, the cache task sets a variable (CACHE_RESTORED) to 'true' when a cache hit occurs. The install step should use 'npm install' as the command to install Node.js dependencies, and it should be conditionally run only when the cache

Submitted by renata2k· Mar 6, 2026Design and Implement Pipelines - specifically configuring build optimization techniques such as dependency caching in Azure DevOps YAML pipelines to improve build performance.

Question

Drag and Drop Question You have an Azure DevOps pipeline that is used to deploy a Node.js app. You need to ensure that the dependencies are cached between builds. How should you configure the deployment YAML? 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:

Exhibit

AZ-400 question #437 exhibit

Answer Area

Drag items

always()build.sheq(variables.CACHE_RESTORED, 'true')integrationtest.shne(variables.CACHE_RESTORED, 'true')npm install

Correct arrangement

  • npm install
  • ne(variables.CACHE_RESTORED, 'true')

Explanation

When caching dependencies in Azure DevOps pipelines, the cache task sets a variable (CACHE_RESTORED) to 'true' when a cache hit occurs. The install step should use 'npm install' as the command to install Node.js dependencies, and it should be conditionally run only when the cache was NOT restored - hence the condition 'ne(variables.CACHE_RESTORED, 'true')'. This prevents unnecessary reinstallation of packages when a valid cache already exists, saving build time.

Topics

#Azure DevOps Pipelines#Pipeline Caching#Node.js CI/CD#YAML Pipeline Configuration

Community Discussion

No community discussion yet for this question.

Full AZ-400 Practice