Courseiva
Design and implement build and release pipelineshardMultiple ChoiceObjective-mapped

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

Exhibit

{
  "steps": [
    {
      "task": "DotNetCoreCLI@2",
      "inputs": {
        "command": "publish",
        "publishWebProjects": true,
        "zipAfterPublish": true
      }
    },
    {
      "task": "AzureWebApp@1",
      "inputs": {
        "azureSubscription": "MyServiceConnection",
        "appType": "webApp",
        "appName": "myapp",
        "package": "$(System.DefaultWorkingDirectory)/**/*.zip"
      }
    }
  ]
}

Refer to the exhibit. You have a YAML pipeline with the above steps. The pipeline publishes a web app and deploys to Azure App Service. The deployment fails with error: 'Could not find the package in the specified path.' What is the most likely cause?

⚠ Common exam trap

Watch out — candidates often assume the error is due to a missing zip file (Option C) or a misconfigured service connection (Option D), but the actual cause is a path variable mismatch between the publish output and the deployment task input.

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 package path is wrong; the zip file is in $(Build.ArtifactStagingDirectory).

The error 'Could not find the package in the specified path' indicates that the AzureWebApp task is looking for a deployment package (typically a .zip file) at a path that does not exist. In the exhibit, the `dotnet publish` command outputs to `$(Build.ArtifactStagingDirectory)`, but the subsequent AzureWebApp task likely references a different path (e.g., `$(System.DefaultWorkingDirectory)` or a hardcoded path). The correct path should be `$(Build.ArtifactStagingDirectory)/**/*.zip` to match the published artifact. Option A correctly identifies this path mismatch as the root cause.

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 package path is wrong; the zip file is in $(Build.ArtifactStagingDirectory).

    Why this is correct

    The AzureWebApp task's `package` input is configured with an incorrect file path. The `dotnet publish` command, when run in a YAML pipeline, defaults to publishing the zip package into `$(Build.ArtifactStagingDirectory)`, not into a subfolder like `$(System.DefaultWorkingDirectory)/published` unless explicitly redirected. Because the package path does not point to that staging directory, the task fails with a 'file not found' or 'no package found' error before deployment can begin. Setting `package: '$(Build.ArtifactStagingDirectory)/**/*.zip'` resolves the issue by correctly referencing the output location.

  • The AzureWebApp task input 'appType' is incorrect.

    Why it's wrong here

    The 'appType' input on the AzureWebApp task only selects the application stack (e.g., Windows, Linux, .NET Core) and does not affect how or where the task resolves the deployment package. Since the error is a file-not-found for the package path, this setting is irrelevant to the failure.

  • The dotnet publish command did not generate a zip file.

    Why it's wrong here

    The dotnet publish step likely did produce the zip file, but the AzureWebApp task's 'package' input is pointing to an incorrect path that does not match where the zip was actually output (i.e., $(Build.ArtifactStagingDirectory)). The error is a path resolution problem, not a missing zip artifact from the build.

  • The service connection 'MyServiceConnection' is not authorized.

    Why it's wrong here

    Service connection authorization issues would prevent the AzureWebApp task from authenticating to Azure and would surface as an authentication/authorization error before any file operations. The reported error is specifically about an invalid or missing package file path, which occurs after the task has successfully authenticated and attempted to locate the deployment artifact.

Go deeper

Related to this question

About these practice questions

One of 823 original AZ-400 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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.