Courseiva
Design and implement build and release pipelineshardMultiple ChoiceObjective-mapped

AZ-400 Practice Question: Design and implement build and release pipelines

Exhibit

Refer to the exhibit. You have the following YAML pipeline snippet:

```yaml
jobs:
- job: Build
  steps:
  - task: DotNetCoreCLI@2
    inputs:
      command: 'build'
      projects: '**/*.csproj'
  - task: PublishBuildArtifacts@1
    inputs:
      PathtoPublish: '$(Build.ArtifactStagingDirectory)'
      ArtifactName: 'drop'
```

The pipeline fails because the artifact is empty. What is the most likely cause?

⚠ Common exam trap

The trap here is that candidates often focus on file matching patterns or task names, but the core issue is the missing copy step to the staging directory, which is a fundamental pipeline design concept.

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

The build output is not copied to the staging directory

The most common reason for an empty artifact in Azure Pipelines is that the build output files were not copied to the staging directory (typically $(Build.ArtifactStagingDirectory)) before the PublishBuildArtifacts task runs. The PublishBuildArtifacts task publishes whatever is in the staging directory; if no files are copied there, the artifact will be empty. This is a standard pattern where a Copy Files task or similar step must explicitly place the build outputs into the staging directory.

Answer analysis

Option-by-option breakdown

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

  • The build output is not copied to the staging directory

    Why this is correct

    The PublishBuildArtifacts task publishes files from a staging directory (e.g., $(Build.ArtifactStagingDirectory)). If your build tasks only compile but never copy the compiled output (DLLs, EXEs) to that staging path, Azure DevOps uploads an empty folder, so the artifact contains no files despite the build succeeding.

  • The projects pattern '**/*.csproj' does not match any files

    Why it's wrong here

    If the '**/*.csproj' pattern matched zero project files, the MSBuild or dotnet build task would fail immediately with a 'project(s) matching the pattern were not found' error. Because the build actually reached the artifact-publishing step, this pattern did match projects, so it cannot be the cause of the empty artifact.

  • The task 'PublishBuildArtifacts@1' is misspelled

    Why it's wrong here

    The task name 'PublishBuildArtifacts@1' is a valid, built-in Azure DevOps task identifier. A misspelled task name would trigger a 'task not found' error during pipeline validation or execution, not a successful build that then produces an empty artifact, so this option is incorrect.

  • The artifact name 'drop' is invalid

    Why it's wrong here

    Azure DevOps allows the artifact name 'drop'; in fact, 'drop' is the default artifact name in classic pipeline templates. If the name were invalid, the PublishBuildArtifacts task would reject it with a naming error, but an empty artifact from a valid publish step indicates the staging folder never received the build output, not an invalid name.

About these practice questions

This AZ-400 question is part of Courseiva's 823-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. 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.