Courseiva
Design and implement build and release pipelineseasyMultiple ChoiceObjective-mapped

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

Your build pipeline includes a task that runs unit tests. You want to ensure that if any test fails, the pipeline stops immediately and does not proceed to the next tasks. What should you configure in the pipeline?

⚠ Common exam trap

This question tests knowledge of task control options in Azure Pipelines. 'Continue on error' and 'Run this task' are separate settings. A common trap is confusing 'Run this task' (which controls when a task runs) with 'Continue on error' (which controls what happens after a task fails).

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

Set the 'Continue on error' option to false for the test task.

To stop the pipeline immediately when a test task fails, you must ensure that the task's 'Continue on error' option is false (unchecked). This is the task control option that determines whether a task failure is ignored. When 'Continue on error' is false, a failed task causes the pipeline to stop and subsequent tasks with the default run condition ('Only when all previous tasks have succeeded') will not run. Setting 'Run this task' to 'Only when all previous tasks have succeeded' is the default and only controls whether the test task runs based on prior task results; it does not directly affect what happens after the test task fails. Therefore, option A is the correct configuration.

Answer analysis

Option-by-option breakdown

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

  • Set the 'Continue on error' option to false for the test task.

    Why this is correct

    'Continue on error' true allows continuation; false stops the task but not necessarily the pipeline.

  • Add a custom condition to the test task to only run if previous tasks succeeded.

    Why it's wrong here

    Adding a custom condition to run only if previous tasks succeeded is redundant because Azure Pipelines already applies that as the default condition for every task. The default condition, `succeeded()`, is exactly what is needed; introducing a custom condition adds unnecessary complexity without changing the outcome.

  • Set the 'Always run' option for the test task.

    Why it's wrong here

    Setting the 'Always run' option configures the task's condition to `always()` (or `succeededOrFailed()`), which forces the test task to execute even when a previous task has failed. This is the opposite of the desired behavior, which is to halt the pipeline and skip the tests upon a failure.

  • Ensure the task control option 'Run this task' is set to 'Only when all previous tasks have succeeded'.

    Why it's wrong here

    Selecting 'Only when all previous tasks have succeeded' sets the task condition to `succeeded()`, the default and correct behavior for ensuring the test task runs only after every upstream step has passed. If any prior task fails, the test task is skipped, and the job is marked as failed, which directly satisfies the requirement to stop the pipeline on failure.

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

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.