Courseiva

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.

⚠ Common exam trap

AZ-400 often tests the distinction between build-time instrumentation (pipeline task logging) and runtime monitoring (Application Insights), luring candidates toward APM tools when the failure occurs during the build/restore phase.

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.

Verbose logging on the npm install task surfaces the exact package resolution, registry URL, and dependency tree being used on the hosted agent, which is where the failure occurs. Comparing that output against the successful local run reveals differences such as a missing package-lock.json, a different registry, or a case-sensitivity issue on the Linux hosted agent. This is a diagnostic instrumentation step, which is what the question asks for.

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

    Swapping to a self-hosted agent changes the execution environment but adds no diagnostic output, so the missing npm package remains unidentified. It is tempting because the pipeline succeeds locally, and would be correct when hosted-agent limitations such as blocked network access or missing tools must be removed.

  • ✗

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

    Why it's wrong here

    Application Insights instruments the running Node.js application, capturing runtime telemetry after deployment, not the npm restore step that fails during the build. It is tempting because it is the standard Azure monitoring service, and would be correct for diagnosing application exceptions and performance in production.

  • ✓

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

    Why this is correct

    Verbose logging on the npm install task exposes dependency resolution, registry access and package versions, revealing why the hosted agent differs from the local one. Comparing outputs pinpoints the missing package's source, satisfying the need to diagnose intermittent hosted-agent failures.

  • ✗

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

    Why it's wrong here

    A cache task speeds up npm restore but does not reveal why a package is absent on the hosted agent, and a stale cache can mask the fault. It is tempting because caching is a common build optimisation, and would be correct when repeated dependency downloads slow pipelines rather than fail.

About these practice questions

Courseiva writes every AZ-400 question from scratch — 696 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 and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official Microsoft exam blueprint

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.