Courseiva
easyMultiple ChoiceObjective-mapped

AZ-400 Practice Question: A team wants to automatically destroy a temporary…

A team wants to automatically destroy a temporary test environment after a pull request is merged or closed. What Azure DevOps feature should they use?

⚠ Common exam trap

The trap is confusing environment approvals (a gating mechanism) with automation triggers. Approvals require human intervention and do not automatically initiate cleanup on PR merge/close.

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

Service hook to Azure Functions

To automatically destroy a temporary test environment after a pull request is merged or closed, a service hook can subscribe to pull request lifecycle events (e.g., 'Pull request merged' or 'Pull request updated') and invoke an Azure Function to perform the cleanup. Environments with post-deployment approvals are used for controlling manual approvals before or after deployment, not for triggering resource destruction on PR events. Branch policies and branch deletion triggers do not inherently respond to PR merge/close events with environment management.

Answer analysis

Option-by-option breakdown

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

  • Environment with post-deployment approvals

    Why it's wrong here

    In Azure DevOps, environments can have post-deployment approvals configured. When a deployment completes, the approval step can be used to invoke a cleanup job if the environment is no longer required, making it a built-in mechanism for destroying temporary test environments.

  • Branch policy with required reviewers

    Why it's wrong here

    Branch policies with required reviewers control the quality of code changes by mandating reviews before merging pull requests. They operate at the source control level and have no capability to manage or destroy deployed environments, so they cannot automate environment cleanup.

  • Pipeline trigger on branch deletion

    Why it's wrong here

    A pipeline trigger on branch deletion can start a new pipeline run when a branch is removed, but it does not automatically clean up or destroy the corresponding environment. You would need to detach the environment separately or define additional steps, so this is not a native environment lifecycle feature.

  • Service hook to Azure Functions

    Why this is correct

    Service hooks can trigger external processes but are not the built-in feature for environment cleanup.

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.