Skip to main content
  1. Public practice questions
  2. AZ-104 Practice Exams | Azure Administrator Associate
  3. AZ-104 Case Study Set

Question 39 — AZ-104 Case Study Set

Review Paideffort's regional policy rule.

"policyRule": {
  "if": {
    "anyOf": [
      {
        "field": "location",
        "notIn": "[parameters('listOfAllowedLocations')]"
      },
      {
        "field": "location",
        "notEquals": "global"
      },
      {
        "field": "type",
        "notEquals": "Microsoft.AzureActiveDirectory/b2cDirectories"
      }
    ]
  },
  "then": {
    "effect": "[parameters('policyEffect')]"
  }
}

Paideffort intends to deny only resources that are outside the allowed regions, are not global, and are not B2C directories. What should be changed in the conditional logic? (Select one answer)

  1. Replace anyOf with allOf so every required violation condition must evaluate as true before the effect applies.

  2. Replace anyOf with not so every individual comparison in the policy rule is automatically inverted.

  3. Replace notIn with in while keeping anyOf so only approved regional resources match the policy.

  4. Replace the type comparison with containsKey so Azure Policy can exclude the B2C resource type.

Correct answers

  1. Replace anyOf with allOf so every required violation condition must evaluate as true before the effect applies.

Explanations

Correct Answer:

Replace anyOf with allOf so every required violation condition must evaluate as true before the effect applies.

Explanation:

Paideffort intends the regional violation to exist only when all three conditions are simultaneously satisfied. With anyOf, a normal regional resource can match merely because its location is not global or because its type is not a B2C directory. allOf implements the intended conjunction.

Wrong Answers:

Replace anyOf with not so every individual comparison in the policy rule is automatically inverted.

not inverts a nested condition or logical expression. It does not replace the requirement that Paideffort evaluate all three individual comparisons together.

Replace notIn with in while keeping anyOf so only approved regional resources match the policy.

This would cause approved locations to participate in matching the policy's enforcement condition and would not correct the broader logical problem created by anyOf.

Replace the type comparison with containsKey so Azure Policy can exclude the B2C resource type.

containsKey is intended for key-containing properties such as tags. It is not an appropriate substitute for comparing the resource type.