Courseiva
Implement an instrumentation strategymediumMultiple ChoiceObjective-mapped

Diagnosing a Private DNS Resolution Failure for an Azure SQL Private Endpoint

Your team uses Azure Pipelines to deploy a Node.js application. Recently, deployments have been failing intermittently due to a missing npm package. The pipeline runs successfully on the local agent but fails on the hosted agent. Which instrumentation strategy should you implement to identify the root cause?

Quick Answer

Enabling verbose logging on the npm install task and comparing output between the working local run and the failing hosted-agent run is the fastest way to isolate an intermittent missing-package issue — it surfaces exactly where dependency resolution diverges, whether that's registry availability, version resolution, or an authentication gap specific to the hosted agent's network path.

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

Enable verbose logging for the npm install task and compare the output between pipeline runs.

Enabling verbose logging for the npm install task allows you to see detailed output of package resolution and installation steps. By comparing the logs between the local agent (success) and hosted agent (failure), you can identify differences in npm registry availability, package versions, or authentication issues that cause the intermittent missing package. Option A is wrong because self-hosted agents might not match the hosted environment's configuration, and the goal is to diagnose the problem on hosted agents. Option B is wrong because Application Insights monitors application runtime behavior, not build-time dependency installation. Option D is wrong because pipeline caching would reuse previously installed packages, which could mask the problem by not performing a fresh install, and does not help identify why the package is missing on hosted agents.

Answer analysis

Option-by-option breakdown

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

  • Replace the hosted agent with a self-hosted agent.

    Why it's wrong here

    This avoids the problem, not diagnose it.

  • Configure Application Insights for the Node.js app to monitor runtime errors.

    Why it's wrong here

    This monitors runtime, not build-time.

  • Enable verbose logging for the npm install task and compare the output between pipeline runs.

    Why this is correct

    Verbose logging shows detailed dependency resolution steps.

  • Add a pipeline cache task for npm packages to ensure consistent restore.

    Why it's wrong here

    Caching may hide the intermittent issue.

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

Same concept, more angles

1 more way this is tested on AZ-400

These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.

Variation 1. You are setting up a build pipeline for a Node.js application that uses npm for package management. The pipeline should restore npm packages on every build, but you want to leverage caching to speed up the process. The pipeline runs on a Microsoft-hosted agent. You also need to ensure that the build fails if any npm audit vulnerabilities are found. Which tasks and configuration should you use?

easy
  • A.Use the 'npm' task with 'custom' command to run 'npm ci'. Use the 'Cache' task to cache 'node_modules' with a key based on 'package.json'.
  • B.Use the 'npm' task with 'install' command without caching. After install, run a PowerShell script to run 'npm audit --audit-level=high' and parse the output.
  • C.Use the 'npm' task with 'ci' command and set 'ignoreScripts' to true. Add a 'npm audit' task but set 'failOnVulnerabilities' to 'false' to avoid build failures.
  • D.Use the 'npm' task with 'install' command and enable caching by setting the 'workingDirectory' variable. Run a separate 'npm' task with 'audit' command and set 'failOnVulnerabilities' to 'true'.

Why D: The correct configuration should use npm ci (via the npm task's 'ci' command or a custom command), cache the npm cache directory (e.g., $(npm_config_cache)) using the Cache task with a key derived from package-lock.json, and include a separate step that runs npm audit and fails the build on vulnerabilities by checking the exit code. Option D is invalid because it references nonexistent Azure DevOps task properties, uses 'install' instead of 'ci', and does not describe proper caching. Since no provided option matches this correct approach, the question has no valid answer.

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.