Courseiva
Develop a security and compliance planmediumMultiple SelectObjective-mapped

Two Approaches to Ensuring Every Deployed Resource Has Required Tags

Your organization uses Azure DevOps and Azure Policy to enforce compliance. You need to ensure that all Azure resources deployed by Azure DevOps pipelines have specific tags (e.g., CostCenter and Environment) applied. Which TWO approaches can achieve this? (Choose TWO.)

Quick Answer

Two layers work together to guarantee tagging: an Azure Policy with a 'deny' effect blocks any resource creation that's missing required tags like CostCenter and Environment at deployment time, and a pipeline task using Azure CLI or PowerShell after resource creation can programmatically apply tags as a remediation backstop for anything that slips through.

⚠ Common exam trap

Many candidates confuse Azure Policy effects (audit vs. deny) and overlook that a post-deployment task can also enforce tagging, leading them to select only the deny policy or incorrectly choose audit as a compliance enforcement mechanism.

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

Create an Azure Policy with the 'deny' effect that requires the tags to be present at resource creation.

An Azure Policy with the 'deny' effect prevents the creation of any resource that does not include the required tags (e.g., CostCenter and Environment). This enforces compliance at the moment of deployment, blocking non-compliant resources from being provisioned by Azure DevOps pipelines. Option D is correct because adding a pipeline task (using Azure CLI or PowerShell) after resource creation programmatically applies the required tags, ensuring resources are tagged even if the initial deployment omitted them.

Answer analysis

Option-by-option breakdown

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

  • Configure the service connection to only allow deployments with tags.

    Why it's wrong here

    Service connections don't enforce tagging.

  • Create an Azure Policy with the 'audit' effect to report non-compliant resources.

    Why it's wrong here

    Audit only reports, does not enforce.

  • Create an Azure Policy with the 'deny' effect that requires the tags to be present at resource creation.

    Why this is correct

    Deny policy blocks deployment of non-compliant resources.

  • Add a pipeline task after resource creation that applies the required tags using Azure CLI or PowerShell.

    Why this is correct

    This remediates missing tags post-deployment.

  • Configure a branch policy on the main branch to require tag verification in pull requests.

    Why it's wrong here

    Branch policies do not affect Azure resource deployment.

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

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. A team wants to enforce that all Azure resource groups in a subscription are tagged with 'CostCenter' and 'Environment'. They need a solution that automatically applies these tags to any new resource group and ensures compliance without manual intervention. What should they use?

easy
  • A.Azure Policy
  • B.Azure RBAC
  • C.Azure Blueprints
  • D.Azure Resource Graph

Why A: Azure Policy is the correct choice because it allows you to define and enforce tagging rules at scale. By creating a policy that requires 'CostCenter' and 'Environment' tags on resource groups, and setting the policy effect to 'deny' or 'append' (to automatically add missing tags), any new resource group creation that violates the policy is blocked or automatically remediated, ensuring compliance without manual intervention.

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.