English original · Source of truth for the Chinese translation. Verified against current Microsoft Learn documentation.

Validation, Testing, Linting and What-If

Build confidence before deployment with compiler diagnostics, linter rules, ARM validation, snapshot testing and what-if interpretation.
BicepAzure Resource ManagerAzure CLIEnglish original · Source of truth for the Chinese translation. Verified against current Microsoft Learn documentation.
Learning outcomes / 学习目标
  • Build, restore and diagnostics — deliver a reviewed, validated change at the right scope
  • Linter rules and configuration — deliver a reviewed, validated change at the right scope
  • Validate versus what-if — deliver a reviewed, validated change at the right scope
  • What-if change types and limits — deliver a reviewed, validated change at the right scope
  • Snapshot testing and normalized templates — deliver a reviewed, validated change at the right scope
  • Negative and policy tests — deliver a reviewed, validated change at the right scope
  • Pre-deployment quality gate lab — deliver a reviewed, validated change at the right scope
  • Review a change plan — deliver a reviewed, validated change at the right scope
Deployments change Azure resources. Write only to an authorized sandbox; confirm tenant, subscription, scope, what-if, permissions and recovery plan first.

Schedule / 课程安排

#ModuleMinutes
1Build, restore and diagnostics7
2Linter rules and configuration7
3Validate versus what-if7
4What-if change types and limits7
5Snapshot testing and normalized templates7
6Negative and policy tests7
7Pre-deployment quality gate lab7
8Review a change plan7

Start / 开始 → · Official references / 官方文档

Warm-up and Azure setup / 课前准备与 Azure 设置

Install Azure CLI, Bicep CLI and the VS Code Bicep extension. Use a sandbox subscription and confirm tenant, subscription, role and budget.

az version
az bicep version
az account show
az bicep build --file main.bicep
az bicep lint --file main.bicep
Do not run create/update before reviewing what-if, identity, target scope and recovery plan.

Build, restore and diagnostics

Hour 7 · Module 1 · 7 min
BicepAzure Resource ManagerEnglish original · Source of truth for the Chinese translation. Verified against current Microsoft Learn documentation.

Core model

Build confidence before deployment with compiler diagnostics, linter rules, ARM validation, snapshot testing and what-if interpretation.

This module uses Build, restore and diagnostics to connect language syntax, ARM evaluation, provider behavior and team ownership. Before writing declarations, identify target scope, resource owner, input source, dependency edges, observable evidence and recovery action.

Key principle: Bicep compiles to ARM JSON and Azure Resource Manager orchestrates resource state. Repeatability is not a safety guarantee; API versions, mutability, external dependencies and authorization still require independent review.

Worked Bicep example

targetScope = 'resourceGroup'

param location string
param environment string

resource workspace 'Microsoft.OperationalInsights/workspaces@2022-10-01' = {
  name: 'law-${environment}'
  location: location
  properties: {
    sku: {
      name: 'PerGB2018'
    }
    retentionInDays: 30
  }
}

output workspaceId string = workspace.id

Trace targetScope, parameter provenance, symbolic references, implicit dependencies and output contract. Validate names, API versions and properties against the target environment and current provider schema.

Design review / 设计评审

Review questions: Who owns Build, restore and diagnostics? Can callers infer defaults? Are inputs constrained by types? What happens on redeploy, manual drift, concurrent change or retry? Could an immutable property replace production data? How can deployment evidence be retained without exposing secrets?

Self-paced practice: choose one or two clinics; the hour schedule is not intended to complete every prompt.

Architecture clinic 1

Scenario: A team is splitting a monolithic template into ownership domains. In this Build, restore and diagnostics drill, the team must trace the resource dependency graph and name the owning module. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an annotated change plan and reviewer sign-off. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 2

Scenario: A release must support both cloud-hosted and private agents. In this Build, restore and diagnostics drill, the team must compare parameter-file values and prove no secret enters logs. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a reproducible lab branch and validation transcript. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 3

Scenario: An environment has drift that must be reconciled before deployment. In this Build, restore and diagnostics drill, the team must review what-if replacement/deletion lines against the data owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a decision record with an explicit rejected alternative. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 4

Scenario: A parameter-file change could expose secrets in source control. In this Build, restore and diagnostics drill, the team must verify scope and principal permissions before provider preflight. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a safe recovery checklist with named operational owners. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 5

Scenario: A policy assignment blocks an otherwise valid deployment. In this Build, restore and diagnostics drill, the team must identify API-version compatibility and the provider schema contract. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an evidence bundle with timestamps and correlation identifiers. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 6

Scenario: A stack deletion plan might detach or remove production assets. In this Build, restore and diagnostics drill, the team must define a canary, success signal, abort threshold and rollback owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a set of positive and negative tests for the declared boundary. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 7

Scenario: A product team is moving a manually configured web workload into version control. In this Build, restore and diagnostics drill, the team must separate template-owned resources from existing and shared assets. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a compatibility note for consumers and a version migration plan. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 8

Scenario: A regulated payment service needs a separate production boundary. In this Build, restore and diagnostics drill, the team must record module version, lock-down source and artifact provenance. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a stop/go gate tied to measurable workload health. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 9

Scenario: A platform team is publishing shared modules for dozens of teams. In this Build, restore and diagnostics drill, the team must trace the resource dependency graph and name the owning module. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an annotated change plan and reviewer sign-off. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 10

Scenario: An acquisition introduces existing subscriptions and naming rules. In this Build, restore and diagnostics drill, the team must compare parameter-file values and prove no secret enters logs. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a reproducible lab branch and validation transcript. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 11

Scenario: A deployment must preserve an existing database and its data. In this Build, restore and diagnostics drill, the team must review what-if replacement/deletion lines against the data owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a decision record with an explicit rejected alternative. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 12

Scenario: A pipeline currently uses a long-lived service-principal secret. In this Build, restore and diagnostics drill, the team must verify scope and principal permissions before provider preflight. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a safe recovery checklist with named operational owners. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 13

Scenario: A regional rollout needs consistent network and policy baselines. In this Build, restore and diagnostics drill, the team must identify API-version compatibility and the provider schema contract. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an evidence bundle with timestamps and correlation identifiers. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 14

Scenario: A deployment preview shows unexpected resource replacement. In this Build, restore and diagnostics drill, the team must define a canary, success signal, abort threshold and rollback owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a set of positive and negative tests for the declared boundary. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 15

Scenario: A team needs per-environment values without copying templates. In this Build, restore and diagnostics drill, the team must separate template-owned resources from existing and shared assets. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a compatibility note for consumers and a version migration plan. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 16

Scenario: A resource provider API version changes its required property shape. In this Build, restore and diagnostics drill, the team must record module version, lock-down source and artifact provenance. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a stop/go gate tied to measurable workload health. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 17

Scenario: An auditor needs reproducible evidence for each infrastructure change. In this Build, restore and diagnostics drill, the team must trace the resource dependency graph and name the owning module. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an annotated change plan and reviewer sign-off. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 18

Scenario: A shared module has breaking changes planned for a new release. In this Build, restore and diagnostics drill, the team must compare parameter-file values and prove no secret enters logs. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a reproducible lab branch and validation transcript. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 19

Scenario: A policy denies public endpoints but a legacy system depends on one. In this Build, restore and diagnostics drill, the team must review what-if replacement/deletion lines against the data owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a decision record with an explicit rejected alternative. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 20

Scenario: A team needs separate owners for subscription and workload resources. In this Build, restore and diagnostics drill, the team must verify scope and principal permissions before provider preflight. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a safe recovery checklist with named operational owners. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 21

Scenario: A failed pipeline leaves a partially completed deployment. In this Build, restore and diagnostics drill, the team must identify API-version compatibility and the provider schema contract. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an evidence bundle with timestamps and correlation identifiers. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 22

Scenario: A development environment must be safely torn down every sprint. In this Build, restore and diagnostics drill, the team must define a canary, success signal, abort threshold and rollback owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a set of positive and negative tests for the declared boundary. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 23

Scenario: A production change must pass review before any write operation. In this Build, restore and diagnostics drill, the team must separate template-owned resources from existing and shared assets. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a compatibility note for consumers and a version migration plan. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 24

Scenario: A nested module unexpectedly deploys to the wrong scope. In this Build, restore and diagnostics drill, the team must record module version, lock-down source and artifact provenance. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a stop/go gate tied to measurable workload health. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 25

Scenario: A template contains a secret copied from a local parameter file. In this Build, restore and diagnostics drill, the team must trace the resource dependency graph and name the owning module. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an annotated change plan and reviewer sign-off. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 26

Scenario: A release introduces a naming collision in one environment. In this Build, restore and diagnostics drill, the team must compare parameter-file values and prove no secret enters logs. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a reproducible lab branch and validation transcript. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 27

Scenario: A central team wants to enforce diagnostic settings consistently. In this Build, restore and diagnostics drill, the team must review what-if replacement/deletion lines against the data owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a decision record with an explicit rejected alternative. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 28

Scenario: A deployment stack may delete resources removed from its template. In this Build, restore and diagnostics drill, the team must verify scope and principal permissions before provider preflight. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a safe recovery checklist with named operational owners. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 29

Scenario: A module registry artifact is missing or inaccessible in CI. In this Build, restore and diagnostics drill, the team must identify API-version compatibility and the provider schema contract. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an evidence bundle with timestamps and correlation identifiers. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 30

Scenario: A resource is changed manually after a successful deployment. In this Build, restore and diagnostics drill, the team must define a canary, success signal, abort threshold and rollback owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a set of positive and negative tests for the declared boundary. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 31

Scenario: A what-if report contains many no-change and unsupported lines. In this Build, restore and diagnostics drill, the team must separate template-owned resources from existing and shared assets. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a compatibility note for consumers and a version migration plan. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 32

Scenario: A pipeline needs to deploy to multiple subscriptions with OIDC. In this Build, restore and diagnostics drill, the team must record module version, lock-down source and artifact provenance. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a stop/go gate tied to measurable workload health. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 33

Scenario: A team is migrating a large ARM JSON template incrementally. In this Build, restore and diagnostics drill, the team must trace the resource dependency graph and name the owning module. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an annotated change plan and reviewer sign-off. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 34

Scenario: A compliance team needs a time-bounded exception process. In this Build, restore and diagnostics drill, the team must compare parameter-file values and prove no secret enters logs. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a reproducible lab branch and validation transcript. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 35

Scenario: A deployment is close to subscription quota limits. In this Build, restore and diagnostics drill, the team must review what-if replacement/deletion lines against the data owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a decision record with an explicit rejected alternative. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 36

Scenario: A shared platform module has no clear deprecation policy. In this Build, restore and diagnostics drill, the team must verify scope and principal permissions before provider preflight. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a safe recovery checklist with named operational owners. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 37

Scenario: A stack uses deny settings that could block child resource changes. In this Build, restore and diagnostics drill, the team must identify API-version compatibility and the provider schema contract. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an evidence bundle with timestamps and correlation identifiers. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 38

Scenario: A resource is supported only in selected Azure regions. In this Build, restore and diagnostics drill, the team must define a canary, success signal, abort threshold and rollback owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a set of positive and negative tests for the declared boundary. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 39

Scenario: A team must restore a prior configuration after a faulty change. In this Build, restore and diagnostics drill, the team must separate template-owned resources from existing and shared assets. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a compatibility note for consumers and a version migration plan. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 40

Scenario: A deployment uses a Key Vault reference from another subscription. In this Build, restore and diagnostics drill, the team must record module version, lock-down source and artifact provenance. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a stop/go gate tied to measurable workload health. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 41

Scenario: A module output accidentally exposes a sensitive endpoint token. In this Build, restore and diagnostics drill, the team must trace the resource dependency graph and name the owning module. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an annotated change plan and reviewer sign-off. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 42

Scenario: A new service needs diagnostic, monitoring, and backup coverage. In this Build, restore and diagnostics drill, the team must compare parameter-file values and prove no secret enters logs. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a reproducible lab branch and validation transcript. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 43

Scenario: A team is standardizing tags and resource naming in Bicep. In this Build, restore and diagnostics drill, the team must review what-if replacement/deletion lines against the data owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a decision record with an explicit rejected alternative. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 44

Scenario: A pipeline must separate validation credentials from deployment identity. In this Build, restore and diagnostics drill, the team must verify scope and principal permissions before provider preflight. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a safe recovery checklist with named operational owners. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 45

Scenario: A management group deployment needs carefully scoped assignments. In this Build, restore and diagnostics drill, the team must identify API-version compatibility and the provider schema contract. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an evidence bundle with timestamps and correlation identifiers. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 46

Scenario: A module change passes build but fails at provider validation. In this Build, restore and diagnostics drill, the team must define a canary, success signal, abort threshold and rollback owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a set of positive and negative tests for the declared boundary. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 47

Scenario: An environment promotion must compare source and target configuration. In this Build, restore and diagnostics drill, the team must separate template-owned resources from existing and shared assets. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a compatibility note for consumers and a version migration plan. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 48

Scenario: A team wants to test snapshots without querying live Azure. In this Build, restore and diagnostics drill, the team must record module version, lock-down source and artifact provenance. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a stop/go gate tied to measurable workload health. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Deployment and ownership diagram

Git change → Bicep build / lint → validation → what-if review → scoped identity → ARM deployment → resource provider → activity/deployment evidence

Mark credential boundaries, approval ownership, correlation IDs and safe stop points at each transition.

Change sequence

1. Record desired state and affected owners

2. Build/lint locally and review the diff

3. Run validate and what-if at target scope

4. Approve and deploy in stages

5. Check resources, activity log and workload health

6. Retain evidence and rollback decision

Read-only and local commands

az bicep version
az bicep build --file main.bicep
az bicep lint --file main.bicep
az deployment group validate --resource-group <rg> --template-file main.bicep
az deployment group what-if --resource-group <rg> --template-file main.bicep
az deployment group show --resource-group <rg> --name <deployment-name>

Run az account show first to confirm tenant, subscription and principal. Validate and what-if can perform preflight checks and require read access; create/update commands submit writes. Production deployment requires reviewed authorization and change plan.

Guided lab / 指导实验

Goal: deliver an auditable Bicep change for Build, restore and diagnostics. (1) Use a sandbox subscription/resource group and confirm caller identity. (2) Copy the sample into a Git branch. (3) express environment differences in parameter files rather than template copies. (4) build, lint and validate. (5) retain what-if output and explain Create/Modify/Delete/NoChange/Ignore line by line. (6) deploy only in the approved lab scope. (7) verify with Azure queries and workload probes. (8) if preview and outcome diverge, stop and retain deployment operations, correlation ID and activity log. Deliver Bicep, sample parameters, preview, verification evidence and rollback note.

Acceptance rubric / 验收标准

Pass only when the template builds, lint findings are dispositioned, parameter and identity boundaries are explicit, what-if has no unexplained destructive change, and deployment output is independently verified.

Production readiness / 生产就绪评审

Scenario: A template should adopt secure defaults without blocking exceptions. Review the production rollout for Build, restore and diagnostics. Submit maintenance window, blast radius, change owner, approver, concurrency policy, quota checks, diagnostics/alerts, rollback trigger, data recovery and business communication. Identify template-owned resources versus existing/external dependencies, consequences of delete or detach, and stop gates for API/module upgrade failure.

Failure-mode rehearsal / 故障演练

Run a tabletop for a denied role assignment, provider validation error, partial deployment, unexpected replacement, throttling and a broken health probe. Assign who stops rollout, who gathers evidence, who restores the last known-good declaration and who communicates status.

Evidence-first troubleshooting / 证据优先排错

For a Build, restore and diagnostics failure, pause retries and automatic promotion. Record commit, CLI/Bicep versions, tenant/subscription/resource group, deployment name and time. Inspect deployment operations, error code, target resource, correlation ID and Activity Log; classify as compiler/type, ARM preflight, RBAC/policy, provider/quota, dependency/runtime or pipeline artifact issue. Preserve raw responses; never use broad permissions, disabled policy or Complete mode as a generic fix.

Knowledge check / 知识检查

Question 1: Build, restore and diagnostics — what evidence should an engineer inspect before changing the template?

State scope, intended state, authorization, API version, dependencies, preview and verification; include observable evidence and rollback conditions.

Question 2: Build, restore and diagnostics — what evidence should an engineer inspect before changing the template?

State scope, intended state, authorization, API version, dependencies, preview and verification; include observable evidence and rollback conditions.

Question 3: Build, restore and diagnostics — what evidence should an engineer inspect before changing the template?

State scope, intended state, authorization, API version, dependencies, preview and verification; include observable evidence and rollback conditions.

Question 4: Build, restore and diagnostics — what evidence should an engineer inspect before changing the template?

State scope, intended state, authorization, API version, dependencies, preview and verification; include observable evidence and rollback conditions.

Question 5: Build, restore and diagnostics — what evidence should an engineer inspect before changing the template?

State scope, intended state, authorization, API version, dependencies, preview and verification; include observable evidence and rollback conditions.

Instructor narration / 讲师讲解提纲

Explain the business value of Build, restore and diagnostics in five minutes. Ask learners to identify state ownership, then draw inputs, resource graph, authorization path and verification evidence. Have a peer act as change approver and challenge destructive differences, secret handling and rollback ownership. Each learner closes with one verified fact, one assumption and one sandbox-safe validation.

Next →

Linter rules and configuration

Hour 7 · Module 2 · 7 min
BicepAzure Resource ManagerEnglish original · Source of truth for the Chinese translation. Verified against current Microsoft Learn documentation.

Core model

Build confidence before deployment with compiler diagnostics, linter rules, ARM validation, snapshot testing and what-if interpretation.

This module uses Linter rules and configuration to connect language syntax, ARM evaluation, provider behavior and team ownership. Before writing declarations, identify target scope, resource owner, input source, dependency edges, observable evidence and recovery action.

Key principle: Bicep compiles to ARM JSON and Azure Resource Manager orchestrates resource state. Repeatability is not a safety guarantee; API versions, mutability, external dependencies and authorization still require independent review.

Worked Bicep example

param appName string
param location string

resource app 'Microsoft.Web/sites@2023-12-01' = {
  name: appName
  location: location
  kind: 'app,linux'
  properties: { httpsOnly: true }
}

output appHost string = app.properties.defaultHostName

Trace targetScope, parameter provenance, symbolic references, implicit dependencies and output contract. Validate names, API versions and properties against the target environment and current provider schema.

Design review / 设计评审

Review questions: Who owns Linter rules and configuration? Can callers infer defaults? Are inputs constrained by types? What happens on redeploy, manual drift, concurrent change or retry? Could an immutable property replace production data? How can deployment evidence be retained without exposing secrets?

Self-paced practice: choose one or two clinics; the hour schedule is not intended to complete every prompt.

Architecture clinic 1

Scenario: A stack deletion plan might detach or remove production assets. In this Linter rules and configuration drill, the team must compare parameter-file values and prove no secret enters logs. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an annotated change plan and reviewer sign-off. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 2

Scenario: A product team is moving a manually configured web workload into version control. In this Linter rules and configuration drill, the team must review what-if replacement/deletion lines against the data owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a reproducible lab branch and validation transcript. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 3

Scenario: A regulated payment service needs a separate production boundary. In this Linter rules and configuration drill, the team must verify scope and principal permissions before provider preflight. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a decision record with an explicit rejected alternative. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 4

Scenario: A platform team is publishing shared modules for dozens of teams. In this Linter rules and configuration drill, the team must identify API-version compatibility and the provider schema contract. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a safe recovery checklist with named operational owners. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 5

Scenario: An acquisition introduces existing subscriptions and naming rules. In this Linter rules and configuration drill, the team must define a canary, success signal, abort threshold and rollback owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an evidence bundle with timestamps and correlation identifiers. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 6

Scenario: A deployment must preserve an existing database and its data. In this Linter rules and configuration drill, the team must separate template-owned resources from existing and shared assets. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a set of positive and negative tests for the declared boundary. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 7

Scenario: A pipeline currently uses a long-lived service-principal secret. In this Linter rules and configuration drill, the team must record module version, lock-down source and artifact provenance. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a compatibility note for consumers and a version migration plan. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 8

Scenario: A regional rollout needs consistent network and policy baselines. In this Linter rules and configuration drill, the team must trace the resource dependency graph and name the owning module. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a stop/go gate tied to measurable workload health. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 9

Scenario: A deployment preview shows unexpected resource replacement. In this Linter rules and configuration drill, the team must compare parameter-file values and prove no secret enters logs. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an annotated change plan and reviewer sign-off. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 10

Scenario: A team needs per-environment values without copying templates. In this Linter rules and configuration drill, the team must review what-if replacement/deletion lines against the data owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a reproducible lab branch and validation transcript. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 11

Scenario: A resource provider API version changes its required property shape. In this Linter rules and configuration drill, the team must verify scope and principal permissions before provider preflight. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a decision record with an explicit rejected alternative. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 12

Scenario: An auditor needs reproducible evidence for each infrastructure change. In this Linter rules and configuration drill, the team must identify API-version compatibility and the provider schema contract. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a safe recovery checklist with named operational owners. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 13

Scenario: A shared module has breaking changes planned for a new release. In this Linter rules and configuration drill, the team must define a canary, success signal, abort threshold and rollback owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an evidence bundle with timestamps and correlation identifiers. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 14

Scenario: A policy denies public endpoints but a legacy system depends on one. In this Linter rules and configuration drill, the team must separate template-owned resources from existing and shared assets. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a set of positive and negative tests for the declared boundary. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 15

Scenario: A team needs separate owners for subscription and workload resources. In this Linter rules and configuration drill, the team must record module version, lock-down source and artifact provenance. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a compatibility note for consumers and a version migration plan. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 16

Scenario: A failed pipeline leaves a partially completed deployment. In this Linter rules and configuration drill, the team must trace the resource dependency graph and name the owning module. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a stop/go gate tied to measurable workload health. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 17

Scenario: A development environment must be safely torn down every sprint. In this Linter rules and configuration drill, the team must compare parameter-file values and prove no secret enters logs. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an annotated change plan and reviewer sign-off. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 18

Scenario: A production change must pass review before any write operation. In this Linter rules and configuration drill, the team must review what-if replacement/deletion lines against the data owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a reproducible lab branch and validation transcript. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 19

Scenario: A nested module unexpectedly deploys to the wrong scope. In this Linter rules and configuration drill, the team must verify scope and principal permissions before provider preflight. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a decision record with an explicit rejected alternative. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 20

Scenario: A template contains a secret copied from a local parameter file. In this Linter rules and configuration drill, the team must identify API-version compatibility and the provider schema contract. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a safe recovery checklist with named operational owners. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 21

Scenario: A release introduces a naming collision in one environment. In this Linter rules and configuration drill, the team must define a canary, success signal, abort threshold and rollback owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an evidence bundle with timestamps and correlation identifiers. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 22

Scenario: A central team wants to enforce diagnostic settings consistently. In this Linter rules and configuration drill, the team must separate template-owned resources from existing and shared assets. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a set of positive and negative tests for the declared boundary. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 23

Scenario: A deployment stack may delete resources removed from its template. In this Linter rules and configuration drill, the team must record module version, lock-down source and artifact provenance. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a compatibility note for consumers and a version migration plan. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 24

Scenario: A module registry artifact is missing or inaccessible in CI. In this Linter rules and configuration drill, the team must trace the resource dependency graph and name the owning module. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a stop/go gate tied to measurable workload health. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 25

Scenario: A resource is changed manually after a successful deployment. In this Linter rules and configuration drill, the team must compare parameter-file values and prove no secret enters logs. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an annotated change plan and reviewer sign-off. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 26

Scenario: A what-if report contains many no-change and unsupported lines. In this Linter rules and configuration drill, the team must review what-if replacement/deletion lines against the data owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a reproducible lab branch and validation transcript. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 27

Scenario: A pipeline needs to deploy to multiple subscriptions with OIDC. In this Linter rules and configuration drill, the team must verify scope and principal permissions before provider preflight. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a decision record with an explicit rejected alternative. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 28

Scenario: A team is migrating a large ARM JSON template incrementally. In this Linter rules and configuration drill, the team must identify API-version compatibility and the provider schema contract. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a safe recovery checklist with named operational owners. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 29

Scenario: A compliance team needs a time-bounded exception process. In this Linter rules and configuration drill, the team must define a canary, success signal, abort threshold and rollback owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an evidence bundle with timestamps and correlation identifiers. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 30

Scenario: A deployment is close to subscription quota limits. In this Linter rules and configuration drill, the team must separate template-owned resources from existing and shared assets. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a set of positive and negative tests for the declared boundary. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 31

Scenario: A shared platform module has no clear deprecation policy. In this Linter rules and configuration drill, the team must record module version, lock-down source and artifact provenance. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a compatibility note for consumers and a version migration plan. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 32

Scenario: A stack uses deny settings that could block child resource changes. In this Linter rules and configuration drill, the team must trace the resource dependency graph and name the owning module. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a stop/go gate tied to measurable workload health. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 33

Scenario: A resource is supported only in selected Azure regions. In this Linter rules and configuration drill, the team must compare parameter-file values and prove no secret enters logs. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an annotated change plan and reviewer sign-off. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 34

Scenario: A team must restore a prior configuration after a faulty change. In this Linter rules and configuration drill, the team must review what-if replacement/deletion lines against the data owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a reproducible lab branch and validation transcript. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 35

Scenario: A deployment uses a Key Vault reference from another subscription. In this Linter rules and configuration drill, the team must verify scope and principal permissions before provider preflight. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a decision record with an explicit rejected alternative. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 36

Scenario: A module output accidentally exposes a sensitive endpoint token. In this Linter rules and configuration drill, the team must identify API-version compatibility and the provider schema contract. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a safe recovery checklist with named operational owners. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 37

Scenario: A new service needs diagnostic, monitoring, and backup coverage. In this Linter rules and configuration drill, the team must define a canary, success signal, abort threshold and rollback owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an evidence bundle with timestamps and correlation identifiers. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 38

Scenario: A team is standardizing tags and resource naming in Bicep. In this Linter rules and configuration drill, the team must separate template-owned resources from existing and shared assets. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a set of positive and negative tests for the declared boundary. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 39

Scenario: A pipeline must separate validation credentials from deployment identity. In this Linter rules and configuration drill, the team must record module version, lock-down source and artifact provenance. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a compatibility note for consumers and a version migration plan. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 40

Scenario: A management group deployment needs carefully scoped assignments. In this Linter rules and configuration drill, the team must trace the resource dependency graph and name the owning module. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a stop/go gate tied to measurable workload health. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 41

Scenario: A module change passes build but fails at provider validation. In this Linter rules and configuration drill, the team must compare parameter-file values and prove no secret enters logs. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an annotated change plan and reviewer sign-off. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 42

Scenario: An environment promotion must compare source and target configuration. In this Linter rules and configuration drill, the team must review what-if replacement/deletion lines against the data owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a reproducible lab branch and validation transcript. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 43

Scenario: A team wants to test snapshots without querying live Azure. In this Linter rules and configuration drill, the team must verify scope and principal permissions before provider preflight. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a decision record with an explicit rejected alternative. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 44

Scenario: A production resource has immutable properties that cannot be replaced. In this Linter rules and configuration drill, the team must identify API-version compatibility and the provider schema contract. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a safe recovery checklist with named operational owners. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 45

Scenario: A module uses experimental features without an upgrade owner. In this Linter rules and configuration drill, the team must define a canary, success signal, abort threshold and rollback owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an evidence bundle with timestamps and correlation identifiers. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 46

Scenario: A cost review asks which resources a template owns. In this Linter rules and configuration drill, the team must separate template-owned resources from existing and shared assets. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a set of positive and negative tests for the declared boundary. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 47

Scenario: A team needs an audited emergency deployment path. In this Linter rules and configuration drill, the team must record module version, lock-down source and artifact provenance. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a compatibility note for consumers and a version migration plan. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 48

Scenario: A public module dependency changes upstream behavior. In this Linter rules and configuration drill, the team must trace the resource dependency graph and name the owning module. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a stop/go gate tied to measurable workload health. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Deployment and ownership diagram

Git change → Bicep build / lint → validation → what-if review → scoped identity → ARM deployment → resource provider → activity/deployment evidence

Mark credential boundaries, approval ownership, correlation IDs and safe stop points at each transition.

Change sequence

1. Record desired state and affected owners

2. Build/lint locally and review the diff

3. Run validate and what-if at target scope

4. Approve and deploy in stages

5. Check resources, activity log and workload health

6. Retain evidence and rollback decision

Read-only and local commands

az bicep version
az bicep build --file main.bicep
az bicep lint --file main.bicep
az deployment group validate --resource-group <rg> --template-file main.bicep
az deployment group what-if --resource-group <rg> --template-file main.bicep
az deployment group show --resource-group <rg> --name <deployment-name>

Run az account show first to confirm tenant, subscription and principal. Validate and what-if can perform preflight checks and require read access; create/update commands submit writes. Production deployment requires reviewed authorization and change plan.

Guided lab / 指导实验

Goal: deliver an auditable Bicep change for Linter rules and configuration. (1) Use a sandbox subscription/resource group and confirm caller identity. (2) Copy the sample into a Git branch. (3) express environment differences in parameter files rather than template copies. (4) build, lint and validate. (5) retain what-if output and explain Create/Modify/Delete/NoChange/Ignore line by line. (6) deploy only in the approved lab scope. (7) verify with Azure queries and workload probes. (8) if preview and outcome diverge, stop and retain deployment operations, correlation ID and activity log. Deliver Bicep, sample parameters, preview, verification evidence and rollback note.

Acceptance rubric / 验收标准

Pass only when the template builds, lint findings are dispositioned, parameter and identity boundaries are explicit, what-if has no unexplained destructive change, and deployment output is independently verified.

Production readiness / 生产就绪评审

Scenario: A release must support both cloud-hosted and private agents. Review the production rollout for Linter rules and configuration. Submit maintenance window, blast radius, change owner, approver, concurrency policy, quota checks, diagnostics/alerts, rollback trigger, data recovery and business communication. Identify template-owned resources versus existing/external dependencies, consequences of delete or detach, and stop gates for API/module upgrade failure.

Failure-mode rehearsal / 故障演练

Run a tabletop for a denied role assignment, provider validation error, partial deployment, unexpected replacement, throttling and a broken health probe. Assign who stops rollout, who gathers evidence, who restores the last known-good declaration and who communicates status.

Evidence-first troubleshooting / 证据优先排错

For a Linter rules and configuration failure, pause retries and automatic promotion. Record commit, CLI/Bicep versions, tenant/subscription/resource group, deployment name and time. Inspect deployment operations, error code, target resource, correlation ID and Activity Log; classify as compiler/type, ARM preflight, RBAC/policy, provider/quota, dependency/runtime or pipeline artifact issue. Preserve raw responses; never use broad permissions, disabled policy or Complete mode as a generic fix.

Knowledge check / 知识检查

Question 1: Linter rules and configuration — what evidence should an engineer inspect before changing the template?

State scope, intended state, authorization, API version, dependencies, preview and verification; include observable evidence and rollback conditions.

Question 2: Linter rules and configuration — what evidence should an engineer inspect before changing the template?

State scope, intended state, authorization, API version, dependencies, preview and verification; include observable evidence and rollback conditions.

Question 3: Linter rules and configuration — what evidence should an engineer inspect before changing the template?

State scope, intended state, authorization, API version, dependencies, preview and verification; include observable evidence and rollback conditions.

Question 4: Linter rules and configuration — what evidence should an engineer inspect before changing the template?

State scope, intended state, authorization, API version, dependencies, preview and verification; include observable evidence and rollback conditions.

Question 5: Linter rules and configuration — what evidence should an engineer inspect before changing the template?

State scope, intended state, authorization, API version, dependencies, preview and verification; include observable evidence and rollback conditions.

Instructor narration / 讲师讲解提纲

Explain the business value of Linter rules and configuration in five minutes. Ask learners to identify state ownership, then draw inputs, resource graph, authorization path and verification evidence. Have a peer act as change approver and challenge destructive differences, secret handling and rollback ownership. Each learner closes with one verified fact, one assumption and one sandbox-safe validation.

Next →

Validate versus what-if

Hour 7 · Module 3 · 7 min
BicepAzure Resource ManagerEnglish original · Source of truth for the Chinese translation. Verified against current Microsoft Learn documentation.

Core model

Build confidence before deployment with compiler diagnostics, linter rules, ARM validation, snapshot testing and what-if interpretation.

This module uses Validate versus what-if to connect language syntax, ARM evaluation, provider behavior and team ownership. Before writing declarations, identify target scope, resource owner, input source, dependency edges, observable evidence and recovery action.

Key principle: Bicep compiles to ARM JSON and Azure Resource Manager orchestrates resource state. Repeatability is not a safety guarantee; API versions, mutability, external dependencies and authorization still require independent review.

Worked Bicep example

targetScope = 'resourceGroup'

param location string = resourceGroup().location
param storageName string

resource storage 'Microsoft.Storage/storageAccounts@2023-05-01' = {
  name: storageName
  location: location
  sku: { name: 'Standard_LRS' }
  kind: 'StorageV2'
  properties: { supportsHttpsTrafficOnly: true }
}

output resourceId string = storage.id

Trace targetScope, parameter provenance, symbolic references, implicit dependencies and output contract. Validate names, API versions and properties against the target environment and current provider schema.

Design review / 设计评审

Review questions: Who owns Validate versus what-if? Can callers infer defaults? Are inputs constrained by types? What happens on redeploy, manual drift, concurrent change or retry? Could an immutable property replace production data? How can deployment evidence be retained without exposing secrets?

Self-paced practice: choose one or two clinics; the hour schedule is not intended to complete every prompt.

Architecture clinic 1

Scenario: A deployment must preserve an existing database and its data. In this Validate versus what-if drill, the team must review what-if replacement/deletion lines against the data owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an annotated change plan and reviewer sign-off. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 2

Scenario: A pipeline currently uses a long-lived service-principal secret. In this Validate versus what-if drill, the team must verify scope and principal permissions before provider preflight. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a reproducible lab branch and validation transcript. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 3

Scenario: A regional rollout needs consistent network and policy baselines. In this Validate versus what-if drill, the team must identify API-version compatibility and the provider schema contract. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a decision record with an explicit rejected alternative. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 4

Scenario: A deployment preview shows unexpected resource replacement. In this Validate versus what-if drill, the team must define a canary, success signal, abort threshold and rollback owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a safe recovery checklist with named operational owners. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 5

Scenario: A team needs per-environment values without copying templates. In this Validate versus what-if drill, the team must separate template-owned resources from existing and shared assets. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an evidence bundle with timestamps and correlation identifiers. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 6

Scenario: A resource provider API version changes its required property shape. In this Validate versus what-if drill, the team must record module version, lock-down source and artifact provenance. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a set of positive and negative tests for the declared boundary. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 7

Scenario: An auditor needs reproducible evidence for each infrastructure change. In this Validate versus what-if drill, the team must trace the resource dependency graph and name the owning module. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a compatibility note for consumers and a version migration plan. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 8

Scenario: A shared module has breaking changes planned for a new release. In this Validate versus what-if drill, the team must compare parameter-file values and prove no secret enters logs. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a stop/go gate tied to measurable workload health. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 9

Scenario: A policy denies public endpoints but a legacy system depends on one. In this Validate versus what-if drill, the team must review what-if replacement/deletion lines against the data owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an annotated change plan and reviewer sign-off. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 10

Scenario: A team needs separate owners for subscription and workload resources. In this Validate versus what-if drill, the team must verify scope and principal permissions before provider preflight. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a reproducible lab branch and validation transcript. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 11

Scenario: A failed pipeline leaves a partially completed deployment. In this Validate versus what-if drill, the team must identify API-version compatibility and the provider schema contract. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a decision record with an explicit rejected alternative. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 12

Scenario: A development environment must be safely torn down every sprint. In this Validate versus what-if drill, the team must define a canary, success signal, abort threshold and rollback owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a safe recovery checklist with named operational owners. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 13

Scenario: A production change must pass review before any write operation. In this Validate versus what-if drill, the team must separate template-owned resources from existing and shared assets. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an evidence bundle with timestamps and correlation identifiers. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 14

Scenario: A nested module unexpectedly deploys to the wrong scope. In this Validate versus what-if drill, the team must record module version, lock-down source and artifact provenance. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a set of positive and negative tests for the declared boundary. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 15

Scenario: A template contains a secret copied from a local parameter file. In this Validate versus what-if drill, the team must trace the resource dependency graph and name the owning module. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a compatibility note for consumers and a version migration plan. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 16

Scenario: A release introduces a naming collision in one environment. In this Validate versus what-if drill, the team must compare parameter-file values and prove no secret enters logs. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a stop/go gate tied to measurable workload health. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 17

Scenario: A central team wants to enforce diagnostic settings consistently. In this Validate versus what-if drill, the team must review what-if replacement/deletion lines against the data owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an annotated change plan and reviewer sign-off. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 18

Scenario: A deployment stack may delete resources removed from its template. In this Validate versus what-if drill, the team must verify scope and principal permissions before provider preflight. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a reproducible lab branch and validation transcript. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 19

Scenario: A module registry artifact is missing or inaccessible in CI. In this Validate versus what-if drill, the team must identify API-version compatibility and the provider schema contract. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a decision record with an explicit rejected alternative. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 20

Scenario: A resource is changed manually after a successful deployment. In this Validate versus what-if drill, the team must define a canary, success signal, abort threshold and rollback owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a safe recovery checklist with named operational owners. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 21

Scenario: A what-if report contains many no-change and unsupported lines. In this Validate versus what-if drill, the team must separate template-owned resources from existing and shared assets. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an evidence bundle with timestamps and correlation identifiers. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 22

Scenario: A pipeline needs to deploy to multiple subscriptions with OIDC. In this Validate versus what-if drill, the team must record module version, lock-down source and artifact provenance. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a set of positive and negative tests for the declared boundary. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 23

Scenario: A team is migrating a large ARM JSON template incrementally. In this Validate versus what-if drill, the team must trace the resource dependency graph and name the owning module. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a compatibility note for consumers and a version migration plan. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 24

Scenario: A compliance team needs a time-bounded exception process. In this Validate versus what-if drill, the team must compare parameter-file values and prove no secret enters logs. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a stop/go gate tied to measurable workload health. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 25

Scenario: A deployment is close to subscription quota limits. In this Validate versus what-if drill, the team must review what-if replacement/deletion lines against the data owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an annotated change plan and reviewer sign-off. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 26

Scenario: A shared platform module has no clear deprecation policy. In this Validate versus what-if drill, the team must verify scope and principal permissions before provider preflight. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a reproducible lab branch and validation transcript. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 27

Scenario: A stack uses deny settings that could block child resource changes. In this Validate versus what-if drill, the team must identify API-version compatibility and the provider schema contract. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a decision record with an explicit rejected alternative. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 28

Scenario: A resource is supported only in selected Azure regions. In this Validate versus what-if drill, the team must define a canary, success signal, abort threshold and rollback owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a safe recovery checklist with named operational owners. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 29

Scenario: A team must restore a prior configuration after a faulty change. In this Validate versus what-if drill, the team must separate template-owned resources from existing and shared assets. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an evidence bundle with timestamps and correlation identifiers. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 30

Scenario: A deployment uses a Key Vault reference from another subscription. In this Validate versus what-if drill, the team must record module version, lock-down source and artifact provenance. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a set of positive and negative tests for the declared boundary. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 31

Scenario: A module output accidentally exposes a sensitive endpoint token. In this Validate versus what-if drill, the team must trace the resource dependency graph and name the owning module. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a compatibility note for consumers and a version migration plan. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 32

Scenario: A new service needs diagnostic, monitoring, and backup coverage. In this Validate versus what-if drill, the team must compare parameter-file values and prove no secret enters logs. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a stop/go gate tied to measurable workload health. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 33

Scenario: A team is standardizing tags and resource naming in Bicep. In this Validate versus what-if drill, the team must review what-if replacement/deletion lines against the data owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an annotated change plan and reviewer sign-off. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 34

Scenario: A pipeline must separate validation credentials from deployment identity. In this Validate versus what-if drill, the team must verify scope and principal permissions before provider preflight. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a reproducible lab branch and validation transcript. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 35

Scenario: A management group deployment needs carefully scoped assignments. In this Validate versus what-if drill, the team must identify API-version compatibility and the provider schema contract. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a decision record with an explicit rejected alternative. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 36

Scenario: A module change passes build but fails at provider validation. In this Validate versus what-if drill, the team must define a canary, success signal, abort threshold and rollback owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a safe recovery checklist with named operational owners. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 37

Scenario: An environment promotion must compare source and target configuration. In this Validate versus what-if drill, the team must separate template-owned resources from existing and shared assets. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an evidence bundle with timestamps and correlation identifiers. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 38

Scenario: A team wants to test snapshots without querying live Azure. In this Validate versus what-if drill, the team must record module version, lock-down source and artifact provenance. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a set of positive and negative tests for the declared boundary. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 39

Scenario: A production resource has immutable properties that cannot be replaced. In this Validate versus what-if drill, the team must trace the resource dependency graph and name the owning module. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a compatibility note for consumers and a version migration plan. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 40

Scenario: A module uses experimental features without an upgrade owner. In this Validate versus what-if drill, the team must compare parameter-file values and prove no secret enters logs. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a stop/go gate tied to measurable workload health. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 41

Scenario: A cost review asks which resources a template owns. In this Validate versus what-if drill, the team must review what-if replacement/deletion lines against the data owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an annotated change plan and reviewer sign-off. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 42

Scenario: A team needs an audited emergency deployment path. In this Validate versus what-if drill, the team must verify scope and principal permissions before provider preflight. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a reproducible lab branch and validation transcript. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 43

Scenario: A public module dependency changes upstream behavior. In this Validate versus what-if drill, the team must identify API-version compatibility and the provider schema contract. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a decision record with an explicit rejected alternative. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 44

Scenario: A resource group is created separately from its workload resources. In this Validate versus what-if drill, the team must define a canary, success signal, abort threshold and rollback owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a safe recovery checklist with named operational owners. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 45

Scenario: A cleanup request could remove shared networking by mistake. In this Validate versus what-if drill, the team must separate template-owned resources from existing and shared assets. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an evidence bundle with timestamps and correlation identifiers. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 46

Scenario: A template has hard-coded environment names in several modules. In this Validate versus what-if drill, the team must record module version, lock-down source and artifact provenance. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a set of positive and negative tests for the declared boundary. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 47

Scenario: A service team needs to roll back an API-version update. In this Validate versus what-if drill, the team must trace the resource dependency graph and name the owning module. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a compatibility note for consumers and a version migration plan. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 48

Scenario: A deployment has a dependency cycle across modules. In this Validate versus what-if drill, the team must compare parameter-file values and prove no secret enters logs. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a stop/go gate tied to measurable workload health. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Deployment and ownership diagram

Git change → Bicep build / lint → validation → what-if review → scoped identity → ARM deployment → resource provider → activity/deployment evidence

Mark credential boundaries, approval ownership, correlation IDs and safe stop points at each transition.

Change sequence

1. Record desired state and affected owners

2. Build/lint locally and review the diff

3. Run validate and what-if at target scope

4. Approve and deploy in stages

5. Check resources, activity log and workload health

6. Retain evidence and rollback decision

Read-only and local commands

az bicep version
az bicep build --file main.bicep
az bicep lint --file main.bicep
az deployment group validate --resource-group <rg> --template-file main.bicep
az deployment group what-if --resource-group <rg> --template-file main.bicep
az deployment group show --resource-group <rg> --name <deployment-name>

Run az account show first to confirm tenant, subscription and principal. Validate and what-if can perform preflight checks and require read access; create/update commands submit writes. Production deployment requires reviewed authorization and change plan.

Guided lab / 指导实验

Goal: deliver an auditable Bicep change for Validate versus what-if. (1) Use a sandbox subscription/resource group and confirm caller identity. (2) Copy the sample into a Git branch. (3) express environment differences in parameter files rather than template copies. (4) build, lint and validate. (5) retain what-if output and explain Create/Modify/Delete/NoChange/Ignore line by line. (6) deploy only in the approved lab scope. (7) verify with Azure queries and workload probes. (8) if preview and outcome diverge, stop and retain deployment operations, correlation ID and activity log. Deliver Bicep, sample parameters, preview, verification evidence and rollback note.

Acceptance rubric / 验收标准

Pass only when the template builds, lint findings are dispositioned, parameter and identity boundaries are explicit, what-if has no unexplained destructive change, and deployment output is independently verified.

Production readiness / 生产就绪评审

Scenario: A policy assignment blocks an otherwise valid deployment. Review the production rollout for Validate versus what-if. Submit maintenance window, blast radius, change owner, approver, concurrency policy, quota checks, diagnostics/alerts, rollback trigger, data recovery and business communication. Identify template-owned resources versus existing/external dependencies, consequences of delete or detach, and stop gates for API/module upgrade failure.

Failure-mode rehearsal / 故障演练

Run a tabletop for a denied role assignment, provider validation error, partial deployment, unexpected replacement, throttling and a broken health probe. Assign who stops rollout, who gathers evidence, who restores the last known-good declaration and who communicates status.

Evidence-first troubleshooting / 证据优先排错

For a Validate versus what-if failure, pause retries and automatic promotion. Record commit, CLI/Bicep versions, tenant/subscription/resource group, deployment name and time. Inspect deployment operations, error code, target resource, correlation ID and Activity Log; classify as compiler/type, ARM preflight, RBAC/policy, provider/quota, dependency/runtime or pipeline artifact issue. Preserve raw responses; never use broad permissions, disabled policy or Complete mode as a generic fix.

Knowledge check / 知识检查

Question 1: Validate versus what-if — what evidence should an engineer inspect before changing the template?

State scope, intended state, authorization, API version, dependencies, preview and verification; include observable evidence and rollback conditions.

Question 2: Validate versus what-if — what evidence should an engineer inspect before changing the template?

State scope, intended state, authorization, API version, dependencies, preview and verification; include observable evidence and rollback conditions.

Question 3: Validate versus what-if — what evidence should an engineer inspect before changing the template?

State scope, intended state, authorization, API version, dependencies, preview and verification; include observable evidence and rollback conditions.

Question 4: Validate versus what-if — what evidence should an engineer inspect before changing the template?

State scope, intended state, authorization, API version, dependencies, preview and verification; include observable evidence and rollback conditions.

Question 5: Validate versus what-if — what evidence should an engineer inspect before changing the template?

State scope, intended state, authorization, API version, dependencies, preview and verification; include observable evidence and rollback conditions.

Instructor narration / 讲师讲解提纲

Explain the business value of Validate versus what-if in five minutes. Ask learners to identify state ownership, then draw inputs, resource graph, authorization path and verification evidence. Have a peer act as change approver and challenge destructive differences, secret handling and rollback ownership. Each learner closes with one verified fact, one assumption and one sandbox-safe validation.

Next →

What-if change types and limits

Hour 7 · Module 4 · 7 min
BicepAzure Resource ManagerEnglish original · Source of truth for the Chinese translation. Verified against current Microsoft Learn documentation.

Core model

Build confidence before deployment with compiler diagnostics, linter rules, ARM validation, snapshot testing and what-if interpretation.

This module uses What-if change types and limits to connect language syntax, ARM evaluation, provider behavior and team ownership. Before writing declarations, identify target scope, resource owner, input source, dependency edges, observable evidence and recovery action.

Key principle: Bicep compiles to ARM JSON and Azure Resource Manager orchestrates resource state. Repeatability is not a safety guarantee; API versions, mutability, external dependencies and authorization still require independent review.

Worked Bicep example

@description('Deployment environment')
@allowed([
  'dev'
  'test'
  'prod'
])
param environment string

@secure()
param bootstrapSecret string

var names = {
  dev: 'Development'
  test: 'Test'
  prod: 'Production'
}

output environmentLabel string = names[environment]

Trace targetScope, parameter provenance, symbolic references, implicit dependencies and output contract. Validate names, API versions and properties against the target environment and current provider schema.

Design review / 设计评审

Review questions: Who owns What-if change types and limits? Can callers infer defaults? Are inputs constrained by types? What happens on redeploy, manual drift, concurrent change or retry? Could an immutable property replace production data? How can deployment evidence be retained without exposing secrets?

Self-paced practice: choose one or two clinics; the hour schedule is not intended to complete every prompt.

Architecture clinic 1

Scenario: A resource provider API version changes its required property shape. In this What-if change types and limits drill, the team must verify scope and principal permissions before provider preflight. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an annotated change plan and reviewer sign-off. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 2

Scenario: An auditor needs reproducible evidence for each infrastructure change. In this What-if change types and limits drill, the team must identify API-version compatibility and the provider schema contract. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a reproducible lab branch and validation transcript. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 3

Scenario: A shared module has breaking changes planned for a new release. In this What-if change types and limits drill, the team must define a canary, success signal, abort threshold and rollback owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a decision record with an explicit rejected alternative. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 4

Scenario: A policy denies public endpoints but a legacy system depends on one. In this What-if change types and limits drill, the team must separate template-owned resources from existing and shared assets. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a safe recovery checklist with named operational owners. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 5

Scenario: A team needs separate owners for subscription and workload resources. In this What-if change types and limits drill, the team must record module version, lock-down source and artifact provenance. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an evidence bundle with timestamps and correlation identifiers. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 6

Scenario: A failed pipeline leaves a partially completed deployment. In this What-if change types and limits drill, the team must trace the resource dependency graph and name the owning module. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a set of positive and negative tests for the declared boundary. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 7

Scenario: A development environment must be safely torn down every sprint. In this What-if change types and limits drill, the team must compare parameter-file values and prove no secret enters logs. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a compatibility note for consumers and a version migration plan. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 8

Scenario: A production change must pass review before any write operation. In this What-if change types and limits drill, the team must review what-if replacement/deletion lines against the data owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a stop/go gate tied to measurable workload health. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 9

Scenario: A nested module unexpectedly deploys to the wrong scope. In this What-if change types and limits drill, the team must verify scope and principal permissions before provider preflight. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an annotated change plan and reviewer sign-off. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 10

Scenario: A template contains a secret copied from a local parameter file. In this What-if change types and limits drill, the team must identify API-version compatibility and the provider schema contract. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a reproducible lab branch and validation transcript. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 11

Scenario: A release introduces a naming collision in one environment. In this What-if change types and limits drill, the team must define a canary, success signal, abort threshold and rollback owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a decision record with an explicit rejected alternative. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 12

Scenario: A central team wants to enforce diagnostic settings consistently. In this What-if change types and limits drill, the team must separate template-owned resources from existing and shared assets. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a safe recovery checklist with named operational owners. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 13

Scenario: A deployment stack may delete resources removed from its template. In this What-if change types and limits drill, the team must record module version, lock-down source and artifact provenance. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an evidence bundle with timestamps and correlation identifiers. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 14

Scenario: A module registry artifact is missing or inaccessible in CI. In this What-if change types and limits drill, the team must trace the resource dependency graph and name the owning module. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a set of positive and negative tests for the declared boundary. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 15

Scenario: A resource is changed manually after a successful deployment. In this What-if change types and limits drill, the team must compare parameter-file values and prove no secret enters logs. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a compatibility note for consumers and a version migration plan. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 16

Scenario: A what-if report contains many no-change and unsupported lines. In this What-if change types and limits drill, the team must review what-if replacement/deletion lines against the data owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a stop/go gate tied to measurable workload health. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 17

Scenario: A pipeline needs to deploy to multiple subscriptions with OIDC. In this What-if change types and limits drill, the team must verify scope and principal permissions before provider preflight. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an annotated change plan and reviewer sign-off. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 18

Scenario: A team is migrating a large ARM JSON template incrementally. In this What-if change types and limits drill, the team must identify API-version compatibility and the provider schema contract. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a reproducible lab branch and validation transcript. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 19

Scenario: A compliance team needs a time-bounded exception process. In this What-if change types and limits drill, the team must define a canary, success signal, abort threshold and rollback owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a decision record with an explicit rejected alternative. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 20

Scenario: A deployment is close to subscription quota limits. In this What-if change types and limits drill, the team must separate template-owned resources from existing and shared assets. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a safe recovery checklist with named operational owners. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 21

Scenario: A shared platform module has no clear deprecation policy. In this What-if change types and limits drill, the team must record module version, lock-down source and artifact provenance. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an evidence bundle with timestamps and correlation identifiers. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 22

Scenario: A stack uses deny settings that could block child resource changes. In this What-if change types and limits drill, the team must trace the resource dependency graph and name the owning module. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a set of positive and negative tests for the declared boundary. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 23

Scenario: A resource is supported only in selected Azure regions. In this What-if change types and limits drill, the team must compare parameter-file values and prove no secret enters logs. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a compatibility note for consumers and a version migration plan. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 24

Scenario: A team must restore a prior configuration after a faulty change. In this What-if change types and limits drill, the team must review what-if replacement/deletion lines against the data owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a stop/go gate tied to measurable workload health. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 25

Scenario: A deployment uses a Key Vault reference from another subscription. In this What-if change types and limits drill, the team must verify scope and principal permissions before provider preflight. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an annotated change plan and reviewer sign-off. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 26

Scenario: A module output accidentally exposes a sensitive endpoint token. In this What-if change types and limits drill, the team must identify API-version compatibility and the provider schema contract. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a reproducible lab branch and validation transcript. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 27

Scenario: A new service needs diagnostic, monitoring, and backup coverage. In this What-if change types and limits drill, the team must define a canary, success signal, abort threshold and rollback owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a decision record with an explicit rejected alternative. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 28

Scenario: A team is standardizing tags and resource naming in Bicep. In this What-if change types and limits drill, the team must separate template-owned resources from existing and shared assets. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a safe recovery checklist with named operational owners. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 29

Scenario: A pipeline must separate validation credentials from deployment identity. In this What-if change types and limits drill, the team must record module version, lock-down source and artifact provenance. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an evidence bundle with timestamps and correlation identifiers. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 30

Scenario: A management group deployment needs carefully scoped assignments. In this What-if change types and limits drill, the team must trace the resource dependency graph and name the owning module. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a set of positive and negative tests for the declared boundary. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 31

Scenario: A module change passes build but fails at provider validation. In this What-if change types and limits drill, the team must compare parameter-file values and prove no secret enters logs. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a compatibility note for consumers and a version migration plan. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 32

Scenario: An environment promotion must compare source and target configuration. In this What-if change types and limits drill, the team must review what-if replacement/deletion lines against the data owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a stop/go gate tied to measurable workload health. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 33

Scenario: A team wants to test snapshots without querying live Azure. In this What-if change types and limits drill, the team must verify scope and principal permissions before provider preflight. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an annotated change plan and reviewer sign-off. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 34

Scenario: A production resource has immutable properties that cannot be replaced. In this What-if change types and limits drill, the team must identify API-version compatibility and the provider schema contract. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a reproducible lab branch and validation transcript. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 35

Scenario: A module uses experimental features without an upgrade owner. In this What-if change types and limits drill, the team must define a canary, success signal, abort threshold and rollback owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a decision record with an explicit rejected alternative. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 36

Scenario: A cost review asks which resources a template owns. In this What-if change types and limits drill, the team must separate template-owned resources from existing and shared assets. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a safe recovery checklist with named operational owners. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 37

Scenario: A team needs an audited emergency deployment path. In this What-if change types and limits drill, the team must record module version, lock-down source and artifact provenance. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an evidence bundle with timestamps and correlation identifiers. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 38

Scenario: A public module dependency changes upstream behavior. In this What-if change types and limits drill, the team must trace the resource dependency graph and name the owning module. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a set of positive and negative tests for the declared boundary. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 39

Scenario: A resource group is created separately from its workload resources. In this What-if change types and limits drill, the team must compare parameter-file values and prove no secret enters logs. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a compatibility note for consumers and a version migration plan. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 40

Scenario: A cleanup request could remove shared networking by mistake. In this What-if change types and limits drill, the team must review what-if replacement/deletion lines against the data owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a stop/go gate tied to measurable workload health. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 41

Scenario: A template has hard-coded environment names in several modules. In this What-if change types and limits drill, the team must verify scope and principal permissions before provider preflight. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an annotated change plan and reviewer sign-off. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 42

Scenario: A service team needs to roll back an API-version update. In this What-if change types and limits drill, the team must identify API-version compatibility and the provider schema contract. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a reproducible lab branch and validation transcript. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 43

Scenario: A deployment has a dependency cycle across modules. In this What-if change types and limits drill, the team must define a canary, success signal, abort threshold and rollback owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a decision record with an explicit rejected alternative. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 44

Scenario: A template should adopt secure defaults without blocking exceptions. In this What-if change types and limits drill, the team must separate template-owned resources from existing and shared assets. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a safe recovery checklist with named operational owners. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 45

Scenario: An engineer needs to explain deployment history and correlation IDs. In this What-if change types and limits drill, the team must record module version, lock-down source and artifact provenance. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an evidence bundle with timestamps and correlation identifiers. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 46

Scenario: A team is splitting a monolithic template into ownership domains. In this What-if change types and limits drill, the team must trace the resource dependency graph and name the owning module. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a set of positive and negative tests for the declared boundary. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 47

Scenario: A release must support both cloud-hosted and private agents. In this What-if change types and limits drill, the team must compare parameter-file values and prove no secret enters logs. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a compatibility note for consumers and a version migration plan. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 48

Scenario: An environment has drift that must be reconciled before deployment. In this What-if change types and limits drill, the team must review what-if replacement/deletion lines against the data owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a stop/go gate tied to measurable workload health. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Deployment and ownership diagram

Git change → Bicep build / lint → validation → what-if review → scoped identity → ARM deployment → resource provider → activity/deployment evidence

Mark credential boundaries, approval ownership, correlation IDs and safe stop points at each transition.

Change sequence

1. Record desired state and affected owners

2. Build/lint locally and review the diff

3. Run validate and what-if at target scope

4. Approve and deploy in stages

5. Check resources, activity log and workload health

6. Retain evidence and rollback decision

Read-only and local commands

az bicep version
az bicep build --file main.bicep
az bicep lint --file main.bicep
az deployment group validate --resource-group <rg> --template-file main.bicep
az deployment group what-if --resource-group <rg> --template-file main.bicep
az deployment group show --resource-group <rg> --name <deployment-name>

Run az account show first to confirm tenant, subscription and principal. Validate and what-if can perform preflight checks and require read access; create/update commands submit writes. Production deployment requires reviewed authorization and change plan.

Guided lab / 指导实验

Goal: deliver an auditable Bicep change for What-if change types and limits. (1) Use a sandbox subscription/resource group and confirm caller identity. (2) Copy the sample into a Git branch. (3) express environment differences in parameter files rather than template copies. (4) build, lint and validate. (5) retain what-if output and explain Create/Modify/Delete/NoChange/Ignore line by line. (6) deploy only in the approved lab scope. (7) verify with Azure queries and workload probes. (8) if preview and outcome diverge, stop and retain deployment operations, correlation ID and activity log. Deliver Bicep, sample parameters, preview, verification evidence and rollback note.

Acceptance rubric / 验收标准

Pass only when the template builds, lint findings are dispositioned, parameter and identity boundaries are explicit, what-if has no unexplained destructive change, and deployment output is independently verified.

Production readiness / 生产就绪评审

Scenario: A regulated payment service needs a separate production boundary. Review the production rollout for What-if change types and limits. Submit maintenance window, blast radius, change owner, approver, concurrency policy, quota checks, diagnostics/alerts, rollback trigger, data recovery and business communication. Identify template-owned resources versus existing/external dependencies, consequences of delete or detach, and stop gates for API/module upgrade failure.

Failure-mode rehearsal / 故障演练

Run a tabletop for a denied role assignment, provider validation error, partial deployment, unexpected replacement, throttling and a broken health probe. Assign who stops rollout, who gathers evidence, who restores the last known-good declaration and who communicates status.

Evidence-first troubleshooting / 证据优先排错

For a What-if change types and limits failure, pause retries and automatic promotion. Record commit, CLI/Bicep versions, tenant/subscription/resource group, deployment name and time. Inspect deployment operations, error code, target resource, correlation ID and Activity Log; classify as compiler/type, ARM preflight, RBAC/policy, provider/quota, dependency/runtime or pipeline artifact issue. Preserve raw responses; never use broad permissions, disabled policy or Complete mode as a generic fix.

Knowledge check / 知识检查

Question 1: What-if change types and limits — what evidence should an engineer inspect before changing the template?

State scope, intended state, authorization, API version, dependencies, preview and verification; include observable evidence and rollback conditions.

Question 2: What-if change types and limits — what evidence should an engineer inspect before changing the template?

State scope, intended state, authorization, API version, dependencies, preview and verification; include observable evidence and rollback conditions.

Question 3: What-if change types and limits — what evidence should an engineer inspect before changing the template?

State scope, intended state, authorization, API version, dependencies, preview and verification; include observable evidence and rollback conditions.

Question 4: What-if change types and limits — what evidence should an engineer inspect before changing the template?

State scope, intended state, authorization, API version, dependencies, preview and verification; include observable evidence and rollback conditions.

Question 5: What-if change types and limits — what evidence should an engineer inspect before changing the template?

State scope, intended state, authorization, API version, dependencies, preview and verification; include observable evidence and rollback conditions.

Instructor narration / 讲师讲解提纲

Explain the business value of What-if change types and limits in five minutes. Ask learners to identify state ownership, then draw inputs, resource graph, authorization path and verification evidence. Have a peer act as change approver and challenge destructive differences, secret handling and rollback ownership. Each learner closes with one verified fact, one assumption and one sandbox-safe validation.

Next →

Snapshot testing and normalized templates

Hour 7 · Module 5 · 7 min
BicepAzure Resource ManagerEnglish original · Source of truth for the Chinese translation. Verified against current Microsoft Learn documentation.

Core model

Build confidence before deployment with compiler diagnostics, linter rules, ARM validation, snapshot testing and what-if interpretation.

This module uses Snapshot testing and normalized templates to connect language syntax, ARM evaluation, provider behavior and team ownership. Before writing declarations, identify target scope, resource owner, input source, dependency edges, observable evidence and recovery action.

Key principle: Bicep compiles to ARM JSON and Azure Resource Manager orchestrates resource state. Repeatability is not a safety guarantee; API versions, mutability, external dependencies and authorization still require independent review.

Worked Bicep example

param vnetName string
param subnetPrefixes array

resource vnet 'Microsoft.Network/virtualNetworks@2023-09-01' = {
  name: vnetName
  location: resourceGroup().location
  properties: {
    addressSpace: { addressPrefixes: [ '10.40.0.0/16' ] }
    subnets: [for (prefix, i) in subnetPrefixes: {
      name: 'subnet-${i}'
      properties: {
        addressPrefix: prefix
      }
    }]
  }
}

Trace targetScope, parameter provenance, symbolic references, implicit dependencies and output contract. Validate names, API versions and properties against the target environment and current provider schema.

Design review / 设计评审

Review questions: Who owns Snapshot testing and normalized templates? Can callers infer defaults? Are inputs constrained by types? What happens on redeploy, manual drift, concurrent change or retry? Could an immutable property replace production data? How can deployment evidence be retained without exposing secrets?

Self-paced practice: choose one or two clinics; the hour schedule is not intended to complete every prompt.

Architecture clinic 1

Scenario: A failed pipeline leaves a partially completed deployment. In this Snapshot testing and normalized templates drill, the team must identify API-version compatibility and the provider schema contract. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an annotated change plan and reviewer sign-off. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 2

Scenario: A development environment must be safely torn down every sprint. In this Snapshot testing and normalized templates drill, the team must define a canary, success signal, abort threshold and rollback owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a reproducible lab branch and validation transcript. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 3

Scenario: A production change must pass review before any write operation. In this Snapshot testing and normalized templates drill, the team must separate template-owned resources from existing and shared assets. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a decision record with an explicit rejected alternative. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 4

Scenario: A nested module unexpectedly deploys to the wrong scope. In this Snapshot testing and normalized templates drill, the team must record module version, lock-down source and artifact provenance. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a safe recovery checklist with named operational owners. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 5

Scenario: A template contains a secret copied from a local parameter file. In this Snapshot testing and normalized templates drill, the team must trace the resource dependency graph and name the owning module. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an evidence bundle with timestamps and correlation identifiers. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 6

Scenario: A release introduces a naming collision in one environment. In this Snapshot testing and normalized templates drill, the team must compare parameter-file values and prove no secret enters logs. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a set of positive and negative tests for the declared boundary. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 7

Scenario: A central team wants to enforce diagnostic settings consistently. In this Snapshot testing and normalized templates drill, the team must review what-if replacement/deletion lines against the data owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a compatibility note for consumers and a version migration plan. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 8

Scenario: A deployment stack may delete resources removed from its template. In this Snapshot testing and normalized templates drill, the team must verify scope and principal permissions before provider preflight. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a stop/go gate tied to measurable workload health. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 9

Scenario: A module registry artifact is missing or inaccessible in CI. In this Snapshot testing and normalized templates drill, the team must identify API-version compatibility and the provider schema contract. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an annotated change plan and reviewer sign-off. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 10

Scenario: A resource is changed manually after a successful deployment. In this Snapshot testing and normalized templates drill, the team must define a canary, success signal, abort threshold and rollback owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a reproducible lab branch and validation transcript. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 11

Scenario: A what-if report contains many no-change and unsupported lines. In this Snapshot testing and normalized templates drill, the team must separate template-owned resources from existing and shared assets. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a decision record with an explicit rejected alternative. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 12

Scenario: A pipeline needs to deploy to multiple subscriptions with OIDC. In this Snapshot testing and normalized templates drill, the team must record module version, lock-down source and artifact provenance. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a safe recovery checklist with named operational owners. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 13

Scenario: A team is migrating a large ARM JSON template incrementally. In this Snapshot testing and normalized templates drill, the team must trace the resource dependency graph and name the owning module. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an evidence bundle with timestamps and correlation identifiers. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 14

Scenario: A compliance team needs a time-bounded exception process. In this Snapshot testing and normalized templates drill, the team must compare parameter-file values and prove no secret enters logs. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a set of positive and negative tests for the declared boundary. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 15

Scenario: A deployment is close to subscription quota limits. In this Snapshot testing and normalized templates drill, the team must review what-if replacement/deletion lines against the data owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a compatibility note for consumers and a version migration plan. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 16

Scenario: A shared platform module has no clear deprecation policy. In this Snapshot testing and normalized templates drill, the team must verify scope and principal permissions before provider preflight. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a stop/go gate tied to measurable workload health. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 17

Scenario: A stack uses deny settings that could block child resource changes. In this Snapshot testing and normalized templates drill, the team must identify API-version compatibility and the provider schema contract. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an annotated change plan and reviewer sign-off. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 18

Scenario: A resource is supported only in selected Azure regions. In this Snapshot testing and normalized templates drill, the team must define a canary, success signal, abort threshold and rollback owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a reproducible lab branch and validation transcript. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 19

Scenario: A team must restore a prior configuration after a faulty change. In this Snapshot testing and normalized templates drill, the team must separate template-owned resources from existing and shared assets. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a decision record with an explicit rejected alternative. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 20

Scenario: A deployment uses a Key Vault reference from another subscription. In this Snapshot testing and normalized templates drill, the team must record module version, lock-down source and artifact provenance. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a safe recovery checklist with named operational owners. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 21

Scenario: A module output accidentally exposes a sensitive endpoint token. In this Snapshot testing and normalized templates drill, the team must trace the resource dependency graph and name the owning module. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an evidence bundle with timestamps and correlation identifiers. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 22

Scenario: A new service needs diagnostic, monitoring, and backup coverage. In this Snapshot testing and normalized templates drill, the team must compare parameter-file values and prove no secret enters logs. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a set of positive and negative tests for the declared boundary. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 23

Scenario: A team is standardizing tags and resource naming in Bicep. In this Snapshot testing and normalized templates drill, the team must review what-if replacement/deletion lines against the data owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a compatibility note for consumers and a version migration plan. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 24

Scenario: A pipeline must separate validation credentials from deployment identity. In this Snapshot testing and normalized templates drill, the team must verify scope and principal permissions before provider preflight. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a stop/go gate tied to measurable workload health. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 25

Scenario: A management group deployment needs carefully scoped assignments. In this Snapshot testing and normalized templates drill, the team must identify API-version compatibility and the provider schema contract. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an annotated change plan and reviewer sign-off. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 26

Scenario: A module change passes build but fails at provider validation. In this Snapshot testing and normalized templates drill, the team must define a canary, success signal, abort threshold and rollback owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a reproducible lab branch and validation transcript. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 27

Scenario: An environment promotion must compare source and target configuration. In this Snapshot testing and normalized templates drill, the team must separate template-owned resources from existing and shared assets. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a decision record with an explicit rejected alternative. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 28

Scenario: A team wants to test snapshots without querying live Azure. In this Snapshot testing and normalized templates drill, the team must record module version, lock-down source and artifact provenance. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a safe recovery checklist with named operational owners. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 29

Scenario: A production resource has immutable properties that cannot be replaced. In this Snapshot testing and normalized templates drill, the team must trace the resource dependency graph and name the owning module. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an evidence bundle with timestamps and correlation identifiers. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 30

Scenario: A module uses experimental features without an upgrade owner. In this Snapshot testing and normalized templates drill, the team must compare parameter-file values and prove no secret enters logs. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a set of positive and negative tests for the declared boundary. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 31

Scenario: A cost review asks which resources a template owns. In this Snapshot testing and normalized templates drill, the team must review what-if replacement/deletion lines against the data owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a compatibility note for consumers and a version migration plan. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 32

Scenario: A team needs an audited emergency deployment path. In this Snapshot testing and normalized templates drill, the team must verify scope and principal permissions before provider preflight. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a stop/go gate tied to measurable workload health. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 33

Scenario: A public module dependency changes upstream behavior. In this Snapshot testing and normalized templates drill, the team must identify API-version compatibility and the provider schema contract. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an annotated change plan and reviewer sign-off. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 34

Scenario: A resource group is created separately from its workload resources. In this Snapshot testing and normalized templates drill, the team must define a canary, success signal, abort threshold and rollback owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a reproducible lab branch and validation transcript. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 35

Scenario: A cleanup request could remove shared networking by mistake. In this Snapshot testing and normalized templates drill, the team must separate template-owned resources from existing and shared assets. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a decision record with an explicit rejected alternative. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 36

Scenario: A template has hard-coded environment names in several modules. In this Snapshot testing and normalized templates drill, the team must record module version, lock-down source and artifact provenance. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a safe recovery checklist with named operational owners. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 37

Scenario: A service team needs to roll back an API-version update. In this Snapshot testing and normalized templates drill, the team must trace the resource dependency graph and name the owning module. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an evidence bundle with timestamps and correlation identifiers. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 38

Scenario: A deployment has a dependency cycle across modules. In this Snapshot testing and normalized templates drill, the team must compare parameter-file values and prove no secret enters logs. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a set of positive and negative tests for the declared boundary. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 39

Scenario: A template should adopt secure defaults without blocking exceptions. In this Snapshot testing and normalized templates drill, the team must review what-if replacement/deletion lines against the data owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a compatibility note for consumers and a version migration plan. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 40

Scenario: An engineer needs to explain deployment history and correlation IDs. In this Snapshot testing and normalized templates drill, the team must verify scope and principal permissions before provider preflight. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a stop/go gate tied to measurable workload health. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 41

Scenario: A team is splitting a monolithic template into ownership domains. In this Snapshot testing and normalized templates drill, the team must identify API-version compatibility and the provider schema contract. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an annotated change plan and reviewer sign-off. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 42

Scenario: A release must support both cloud-hosted and private agents. In this Snapshot testing and normalized templates drill, the team must define a canary, success signal, abort threshold and rollback owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a reproducible lab branch and validation transcript. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 43

Scenario: An environment has drift that must be reconciled before deployment. In this Snapshot testing and normalized templates drill, the team must separate template-owned resources from existing and shared assets. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a decision record with an explicit rejected alternative. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 44

Scenario: A parameter-file change could expose secrets in source control. In this Snapshot testing and normalized templates drill, the team must record module version, lock-down source and artifact provenance. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a safe recovery checklist with named operational owners. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 45

Scenario: A policy assignment blocks an otherwise valid deployment. In this Snapshot testing and normalized templates drill, the team must trace the resource dependency graph and name the owning module. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an evidence bundle with timestamps and correlation identifiers. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 46

Scenario: A stack deletion plan might detach or remove production assets. In this Snapshot testing and normalized templates drill, the team must compare parameter-file values and prove no secret enters logs. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a set of positive and negative tests for the declared boundary. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 47

Scenario: A product team is moving a manually configured web workload into version control. In this Snapshot testing and normalized templates drill, the team must review what-if replacement/deletion lines against the data owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a compatibility note for consumers and a version migration plan. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 48

Scenario: A regulated payment service needs a separate production boundary. In this Snapshot testing and normalized templates drill, the team must verify scope and principal permissions before provider preflight. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a stop/go gate tied to measurable workload health. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Deployment and ownership diagram

Git change → Bicep build / lint → validation → what-if review → scoped identity → ARM deployment → resource provider → activity/deployment evidence

Mark credential boundaries, approval ownership, correlation IDs and safe stop points at each transition.

Change sequence

1. Record desired state and affected owners

2. Build/lint locally and review the diff

3. Run validate and what-if at target scope

4. Approve and deploy in stages

5. Check resources, activity log and workload health

6. Retain evidence and rollback decision

Read-only and local commands

az bicep version
az bicep build --file main.bicep
az bicep lint --file main.bicep
az deployment group validate --resource-group <rg> --template-file main.bicep
az deployment group what-if --resource-group <rg> --template-file main.bicep
az deployment group show --resource-group <rg> --name <deployment-name>

Run az account show first to confirm tenant, subscription and principal. Validate and what-if can perform preflight checks and require read access; create/update commands submit writes. Production deployment requires reviewed authorization and change plan.

Guided lab / 指导实验

Goal: deliver an auditable Bicep change for Snapshot testing and normalized templates. (1) Use a sandbox subscription/resource group and confirm caller identity. (2) Copy the sample into a Git branch. (3) express environment differences in parameter files rather than template copies. (4) build, lint and validate. (5) retain what-if output and explain Create/Modify/Delete/NoChange/Ignore line by line. (6) deploy only in the approved lab scope. (7) verify with Azure queries and workload probes. (8) if preview and outcome diverge, stop and retain deployment operations, correlation ID and activity log. Deliver Bicep, sample parameters, preview, verification evidence and rollback note.

Acceptance rubric / 验收标准

Pass only when the template builds, lint findings are dispositioned, parameter and identity boundaries are explicit, what-if has no unexplained destructive change, and deployment output is independently verified.

Production readiness / 生产就绪评审

Scenario: A deployment must preserve an existing database and its data. Review the production rollout for Snapshot testing and normalized templates. Submit maintenance window, blast radius, change owner, approver, concurrency policy, quota checks, diagnostics/alerts, rollback trigger, data recovery and business communication. Identify template-owned resources versus existing/external dependencies, consequences of delete or detach, and stop gates for API/module upgrade failure.

Failure-mode rehearsal / 故障演练

Run a tabletop for a denied role assignment, provider validation error, partial deployment, unexpected replacement, throttling and a broken health probe. Assign who stops rollout, who gathers evidence, who restores the last known-good declaration and who communicates status.

Evidence-first troubleshooting / 证据优先排错

For a Snapshot testing and normalized templates failure, pause retries and automatic promotion. Record commit, CLI/Bicep versions, tenant/subscription/resource group, deployment name and time. Inspect deployment operations, error code, target resource, correlation ID and Activity Log; classify as compiler/type, ARM preflight, RBAC/policy, provider/quota, dependency/runtime or pipeline artifact issue. Preserve raw responses; never use broad permissions, disabled policy or Complete mode as a generic fix.

Knowledge check / 知识检查

Question 1: Snapshot testing and normalized templates — what evidence should an engineer inspect before changing the template?

State scope, intended state, authorization, API version, dependencies, preview and verification; include observable evidence and rollback conditions.

Question 2: Snapshot testing and normalized templates — what evidence should an engineer inspect before changing the template?

State scope, intended state, authorization, API version, dependencies, preview and verification; include observable evidence and rollback conditions.

Question 3: Snapshot testing and normalized templates — what evidence should an engineer inspect before changing the template?

State scope, intended state, authorization, API version, dependencies, preview and verification; include observable evidence and rollback conditions.

Question 4: Snapshot testing and normalized templates — what evidence should an engineer inspect before changing the template?

State scope, intended state, authorization, API version, dependencies, preview and verification; include observable evidence and rollback conditions.

Question 5: Snapshot testing and normalized templates — what evidence should an engineer inspect before changing the template?

State scope, intended state, authorization, API version, dependencies, preview and verification; include observable evidence and rollback conditions.

Instructor narration / 讲师讲解提纲

Explain the business value of Snapshot testing and normalized templates in five minutes. Ask learners to identify state ownership, then draw inputs, resource graph, authorization path and verification evidence. Have a peer act as change approver and challenge destructive differences, secret handling and rollback ownership. Each learner closes with one verified fact, one assumption and one sandbox-safe validation.

Next →

Negative and policy tests

Hour 7 · Module 6 · 7 min
BicepAzure Resource ManagerEnglish original · Source of truth for the Chinese translation. Verified against current Microsoft Learn documentation.

Core model

Build confidence before deployment with compiler diagnostics, linter rules, ARM validation, snapshot testing and what-if interpretation.

This module uses Negative and policy tests to connect language syntax, ARM evaluation, provider behavior and team ownership. Before writing declarations, identify target scope, resource owner, input source, dependency edges, observable evidence and recovery action.

Key principle: Bicep compiles to ARM JSON and Azure Resource Manager orchestrates resource state. Repeatability is not a safety guarantee; API versions, mutability, external dependencies and authorization still require independent review.

Worked Bicep example

param location string
param environment string
param addressPrefix string
param diagnosticsWorkspaceId string

module network './modules/network.bicep' = {
  name: 'network-${environment}'
  params: {
    location: location
    addressPrefix: addressPrefix
    diagnosticsWorkspaceId: diagnosticsWorkspaceId
  }
}

output networkId string = network.outputs.vnetId

Trace targetScope, parameter provenance, symbolic references, implicit dependencies and output contract. Validate names, API versions and properties against the target environment and current provider schema.

Design review / 设计评审

Review questions: Who owns Negative and policy tests? Can callers infer defaults? Are inputs constrained by types? What happens on redeploy, manual drift, concurrent change or retry? Could an immutable property replace production data? How can deployment evidence be retained without exposing secrets?

Self-paced practice: choose one or two clinics; the hour schedule is not intended to complete every prompt.

Architecture clinic 1

Scenario: A release introduces a naming collision in one environment. In this Negative and policy tests drill, the team must define a canary, success signal, abort threshold and rollback owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an annotated change plan and reviewer sign-off. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 2

Scenario: A central team wants to enforce diagnostic settings consistently. In this Negative and policy tests drill, the team must separate template-owned resources from existing and shared assets. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a reproducible lab branch and validation transcript. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 3

Scenario: A deployment stack may delete resources removed from its template. In this Negative and policy tests drill, the team must record module version, lock-down source and artifact provenance. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a decision record with an explicit rejected alternative. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 4

Scenario: A module registry artifact is missing or inaccessible in CI. In this Negative and policy tests drill, the team must trace the resource dependency graph and name the owning module. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a safe recovery checklist with named operational owners. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 5

Scenario: A resource is changed manually after a successful deployment. In this Negative and policy tests drill, the team must compare parameter-file values and prove no secret enters logs. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an evidence bundle with timestamps and correlation identifiers. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 6

Scenario: A what-if report contains many no-change and unsupported lines. In this Negative and policy tests drill, the team must review what-if replacement/deletion lines against the data owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a set of positive and negative tests for the declared boundary. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 7

Scenario: A pipeline needs to deploy to multiple subscriptions with OIDC. In this Negative and policy tests drill, the team must verify scope and principal permissions before provider preflight. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a compatibility note for consumers and a version migration plan. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 8

Scenario: A team is migrating a large ARM JSON template incrementally. In this Negative and policy tests drill, the team must identify API-version compatibility and the provider schema contract. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a stop/go gate tied to measurable workload health. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 9

Scenario: A compliance team needs a time-bounded exception process. In this Negative and policy tests drill, the team must define a canary, success signal, abort threshold and rollback owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an annotated change plan and reviewer sign-off. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 10

Scenario: A deployment is close to subscription quota limits. In this Negative and policy tests drill, the team must separate template-owned resources from existing and shared assets. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a reproducible lab branch and validation transcript. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 11

Scenario: A shared platform module has no clear deprecation policy. In this Negative and policy tests drill, the team must record module version, lock-down source and artifact provenance. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a decision record with an explicit rejected alternative. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 12

Scenario: A stack uses deny settings that could block child resource changes. In this Negative and policy tests drill, the team must trace the resource dependency graph and name the owning module. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a safe recovery checklist with named operational owners. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 13

Scenario: A resource is supported only in selected Azure regions. In this Negative and policy tests drill, the team must compare parameter-file values and prove no secret enters logs. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an evidence bundle with timestamps and correlation identifiers. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 14

Scenario: A team must restore a prior configuration after a faulty change. In this Negative and policy tests drill, the team must review what-if replacement/deletion lines against the data owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a set of positive and negative tests for the declared boundary. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 15

Scenario: A deployment uses a Key Vault reference from another subscription. In this Negative and policy tests drill, the team must verify scope and principal permissions before provider preflight. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a compatibility note for consumers and a version migration plan. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 16

Scenario: A module output accidentally exposes a sensitive endpoint token. In this Negative and policy tests drill, the team must identify API-version compatibility and the provider schema contract. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a stop/go gate tied to measurable workload health. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 17

Scenario: A new service needs diagnostic, monitoring, and backup coverage. In this Negative and policy tests drill, the team must define a canary, success signal, abort threshold and rollback owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an annotated change plan and reviewer sign-off. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 18

Scenario: A team is standardizing tags and resource naming in Bicep. In this Negative and policy tests drill, the team must separate template-owned resources from existing and shared assets. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a reproducible lab branch and validation transcript. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 19

Scenario: A pipeline must separate validation credentials from deployment identity. In this Negative and policy tests drill, the team must record module version, lock-down source and artifact provenance. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a decision record with an explicit rejected alternative. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 20

Scenario: A management group deployment needs carefully scoped assignments. In this Negative and policy tests drill, the team must trace the resource dependency graph and name the owning module. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a safe recovery checklist with named operational owners. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 21

Scenario: A module change passes build but fails at provider validation. In this Negative and policy tests drill, the team must compare parameter-file values and prove no secret enters logs. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an evidence bundle with timestamps and correlation identifiers. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 22

Scenario: An environment promotion must compare source and target configuration. In this Negative and policy tests drill, the team must review what-if replacement/deletion lines against the data owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a set of positive and negative tests for the declared boundary. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 23

Scenario: A team wants to test snapshots without querying live Azure. In this Negative and policy tests drill, the team must verify scope and principal permissions before provider preflight. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a compatibility note for consumers and a version migration plan. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 24

Scenario: A production resource has immutable properties that cannot be replaced. In this Negative and policy tests drill, the team must identify API-version compatibility and the provider schema contract. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a stop/go gate tied to measurable workload health. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 25

Scenario: A module uses experimental features without an upgrade owner. In this Negative and policy tests drill, the team must define a canary, success signal, abort threshold and rollback owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an annotated change plan and reviewer sign-off. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 26

Scenario: A cost review asks which resources a template owns. In this Negative and policy tests drill, the team must separate template-owned resources from existing and shared assets. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a reproducible lab branch and validation transcript. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 27

Scenario: A team needs an audited emergency deployment path. In this Negative and policy tests drill, the team must record module version, lock-down source and artifact provenance. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a decision record with an explicit rejected alternative. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 28

Scenario: A public module dependency changes upstream behavior. In this Negative and policy tests drill, the team must trace the resource dependency graph and name the owning module. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a safe recovery checklist with named operational owners. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 29

Scenario: A resource group is created separately from its workload resources. In this Negative and policy tests drill, the team must compare parameter-file values and prove no secret enters logs. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an evidence bundle with timestamps and correlation identifiers. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 30

Scenario: A cleanup request could remove shared networking by mistake. In this Negative and policy tests drill, the team must review what-if replacement/deletion lines against the data owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a set of positive and negative tests for the declared boundary. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 31

Scenario: A template has hard-coded environment names in several modules. In this Negative and policy tests drill, the team must verify scope and principal permissions before provider preflight. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a compatibility note for consumers and a version migration plan. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 32

Scenario: A service team needs to roll back an API-version update. In this Negative and policy tests drill, the team must identify API-version compatibility and the provider schema contract. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a stop/go gate tied to measurable workload health. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 33

Scenario: A deployment has a dependency cycle across modules. In this Negative and policy tests drill, the team must define a canary, success signal, abort threshold and rollback owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an annotated change plan and reviewer sign-off. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 34

Scenario: A template should adopt secure defaults without blocking exceptions. In this Negative and policy tests drill, the team must separate template-owned resources from existing and shared assets. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a reproducible lab branch and validation transcript. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 35

Scenario: An engineer needs to explain deployment history and correlation IDs. In this Negative and policy tests drill, the team must record module version, lock-down source and artifact provenance. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a decision record with an explicit rejected alternative. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 36

Scenario: A team is splitting a monolithic template into ownership domains. In this Negative and policy tests drill, the team must trace the resource dependency graph and name the owning module. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a safe recovery checklist with named operational owners. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 37

Scenario: A release must support both cloud-hosted and private agents. In this Negative and policy tests drill, the team must compare parameter-file values and prove no secret enters logs. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an evidence bundle with timestamps and correlation identifiers. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 38

Scenario: An environment has drift that must be reconciled before deployment. In this Negative and policy tests drill, the team must review what-if replacement/deletion lines against the data owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a set of positive and negative tests for the declared boundary. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 39

Scenario: A parameter-file change could expose secrets in source control. In this Negative and policy tests drill, the team must verify scope and principal permissions before provider preflight. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a compatibility note for consumers and a version migration plan. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 40

Scenario: A policy assignment blocks an otherwise valid deployment. In this Negative and policy tests drill, the team must identify API-version compatibility and the provider schema contract. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a stop/go gate tied to measurable workload health. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 41

Scenario: A stack deletion plan might detach or remove production assets. In this Negative and policy tests drill, the team must define a canary, success signal, abort threshold and rollback owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an annotated change plan and reviewer sign-off. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 42

Scenario: A product team is moving a manually configured web workload into version control. In this Negative and policy tests drill, the team must separate template-owned resources from existing and shared assets. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a reproducible lab branch and validation transcript. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 43

Scenario: A regulated payment service needs a separate production boundary. In this Negative and policy tests drill, the team must record module version, lock-down source and artifact provenance. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a decision record with an explicit rejected alternative. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 44

Scenario: A platform team is publishing shared modules for dozens of teams. In this Negative and policy tests drill, the team must trace the resource dependency graph and name the owning module. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a safe recovery checklist with named operational owners. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 45

Scenario: An acquisition introduces existing subscriptions and naming rules. In this Negative and policy tests drill, the team must compare parameter-file values and prove no secret enters logs. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an evidence bundle with timestamps and correlation identifiers. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 46

Scenario: A deployment must preserve an existing database and its data. In this Negative and policy tests drill, the team must review what-if replacement/deletion lines against the data owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a set of positive and negative tests for the declared boundary. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 47

Scenario: A pipeline currently uses a long-lived service-principal secret. In this Negative and policy tests drill, the team must verify scope and principal permissions before provider preflight. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a compatibility note for consumers and a version migration plan. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 48

Scenario: A regional rollout needs consistent network and policy baselines. In this Negative and policy tests drill, the team must identify API-version compatibility and the provider schema contract. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a stop/go gate tied to measurable workload health. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Deployment and ownership diagram

Git change → Bicep build / lint → validation → what-if review → scoped identity → ARM deployment → resource provider → activity/deployment evidence

Mark credential boundaries, approval ownership, correlation IDs and safe stop points at each transition.

Change sequence

1. Record desired state and affected owners

2. Build/lint locally and review the diff

3. Run validate and what-if at target scope

4. Approve and deploy in stages

5. Check resources, activity log and workload health

6. Retain evidence and rollback decision

Read-only and local commands

az bicep version
az bicep build --file main.bicep
az bicep lint --file main.bicep
az deployment group validate --resource-group <rg> --template-file main.bicep
az deployment group what-if --resource-group <rg> --template-file main.bicep
az deployment group show --resource-group <rg> --name <deployment-name>

Run az account show first to confirm tenant, subscription and principal. Validate and what-if can perform preflight checks and require read access; create/update commands submit writes. Production deployment requires reviewed authorization and change plan.

Guided lab / 指导实验

Goal: deliver an auditable Bicep change for Negative and policy tests. (1) Use a sandbox subscription/resource group and confirm caller identity. (2) Copy the sample into a Git branch. (3) express environment differences in parameter files rather than template copies. (4) build, lint and validate. (5) retain what-if output and explain Create/Modify/Delete/NoChange/Ignore line by line. (6) deploy only in the approved lab scope. (7) verify with Azure queries and workload probes. (8) if preview and outcome diverge, stop and retain deployment operations, correlation ID and activity log. Deliver Bicep, sample parameters, preview, verification evidence and rollback note.

Acceptance rubric / 验收标准

Pass only when the template builds, lint findings are dispositioned, parameter and identity boundaries are explicit, what-if has no unexplained destructive change, and deployment output is independently verified.

Production readiness / 生产就绪评审

Scenario: A deployment preview shows unexpected resource replacement. Review the production rollout for Negative and policy tests. Submit maintenance window, blast radius, change owner, approver, concurrency policy, quota checks, diagnostics/alerts, rollback trigger, data recovery and business communication. Identify template-owned resources versus existing/external dependencies, consequences of delete or detach, and stop gates for API/module upgrade failure.

Failure-mode rehearsal / 故障演练

Run a tabletop for a denied role assignment, provider validation error, partial deployment, unexpected replacement, throttling and a broken health probe. Assign who stops rollout, who gathers evidence, who restores the last known-good declaration and who communicates status.

Evidence-first troubleshooting / 证据优先排错

For a Negative and policy tests failure, pause retries and automatic promotion. Record commit, CLI/Bicep versions, tenant/subscription/resource group, deployment name and time. Inspect deployment operations, error code, target resource, correlation ID and Activity Log; classify as compiler/type, ARM preflight, RBAC/policy, provider/quota, dependency/runtime or pipeline artifact issue. Preserve raw responses; never use broad permissions, disabled policy or Complete mode as a generic fix.

Knowledge check / 知识检查

Question 1: Negative and policy tests — what evidence should an engineer inspect before changing the template?

State scope, intended state, authorization, API version, dependencies, preview and verification; include observable evidence and rollback conditions.

Question 2: Negative and policy tests — what evidence should an engineer inspect before changing the template?

State scope, intended state, authorization, API version, dependencies, preview and verification; include observable evidence and rollback conditions.

Question 3: Negative and policy tests — what evidence should an engineer inspect before changing the template?

State scope, intended state, authorization, API version, dependencies, preview and verification; include observable evidence and rollback conditions.

Question 4: Negative and policy tests — what evidence should an engineer inspect before changing the template?

State scope, intended state, authorization, API version, dependencies, preview and verification; include observable evidence and rollback conditions.

Question 5: Negative and policy tests — what evidence should an engineer inspect before changing the template?

State scope, intended state, authorization, API version, dependencies, preview and verification; include observable evidence and rollback conditions.

Instructor narration / 讲师讲解提纲

Explain the business value of Negative and policy tests in five minutes. Ask learners to identify state ownership, then draw inputs, resource graph, authorization path and verification evidence. Have a peer act as change approver and challenge destructive differences, secret handling and rollback ownership. Each learner closes with one verified fact, one assumption and one sandbox-safe validation.

Next →

Pre-deployment quality gate lab

Hour 7 · Module 7 · 7 min
BicepAzure Resource ManagerEnglish original · Source of truth for the Chinese translation. Verified against current Microsoft Learn documentation.

Core model

Build confidence before deployment with compiler diagnostics, linter rules, ARM validation, snapshot testing and what-if interpretation.

This module uses Pre-deployment quality gate lab to connect language syntax, ARM evaluation, provider behavior and team ownership. Before writing declarations, identify target scope, resource owner, input source, dependency edges, observable evidence and recovery action.

Key principle: Bicep compiles to ARM JSON and Azure Resource Manager orchestrates resource state. Repeatability is not a safety guarantee; API versions, mutability, external dependencies and authorization still require independent review.

Worked Bicep example

targetScope = 'subscription'

param location string
param workloadRg string

resource rg 'Microsoft.Resources/resourceGroups@2024-03-01' = {
  name: workloadRg
  location: location
}

module workload './workload.bicep' = {
  name: 'workload'
  scope: rg
  params: { location: location }
}

Trace targetScope, parameter provenance, symbolic references, implicit dependencies and output contract. Validate names, API versions and properties against the target environment and current provider schema.

Design review / 设计评审

Review questions: Who owns Pre-deployment quality gate lab? Can callers infer defaults? Are inputs constrained by types? What happens on redeploy, manual drift, concurrent change or retry? Could an immutable property replace production data? How can deployment evidence be retained without exposing secrets?

Self-paced practice: choose one or two clinics; the hour schedule is not intended to complete every prompt.

Architecture clinic 1

Scenario: A what-if report contains many no-change and unsupported lines. In this Pre-deployment quality gate lab drill, the team must separate template-owned resources from existing and shared assets. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an annotated change plan and reviewer sign-off. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 2

Scenario: A pipeline needs to deploy to multiple subscriptions with OIDC. In this Pre-deployment quality gate lab drill, the team must record module version, lock-down source and artifact provenance. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a reproducible lab branch and validation transcript. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 3

Scenario: A team is migrating a large ARM JSON template incrementally. In this Pre-deployment quality gate lab drill, the team must trace the resource dependency graph and name the owning module. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a decision record with an explicit rejected alternative. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 4

Scenario: A compliance team needs a time-bounded exception process. In this Pre-deployment quality gate lab drill, the team must compare parameter-file values and prove no secret enters logs. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a safe recovery checklist with named operational owners. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 5

Scenario: A deployment is close to subscription quota limits. In this Pre-deployment quality gate lab drill, the team must review what-if replacement/deletion lines against the data owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an evidence bundle with timestamps and correlation identifiers. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 6

Scenario: A shared platform module has no clear deprecation policy. In this Pre-deployment quality gate lab drill, the team must verify scope and principal permissions before provider preflight. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a set of positive and negative tests for the declared boundary. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 7

Scenario: A stack uses deny settings that could block child resource changes. In this Pre-deployment quality gate lab drill, the team must identify API-version compatibility and the provider schema contract. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a compatibility note for consumers and a version migration plan. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 8

Scenario: A resource is supported only in selected Azure regions. In this Pre-deployment quality gate lab drill, the team must define a canary, success signal, abort threshold and rollback owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a stop/go gate tied to measurable workload health. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 9

Scenario: A team must restore a prior configuration after a faulty change. In this Pre-deployment quality gate lab drill, the team must separate template-owned resources from existing and shared assets. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an annotated change plan and reviewer sign-off. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 10

Scenario: A deployment uses a Key Vault reference from another subscription. In this Pre-deployment quality gate lab drill, the team must record module version, lock-down source and artifact provenance. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a reproducible lab branch and validation transcript. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 11

Scenario: A module output accidentally exposes a sensitive endpoint token. In this Pre-deployment quality gate lab drill, the team must trace the resource dependency graph and name the owning module. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a decision record with an explicit rejected alternative. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 12

Scenario: A new service needs diagnostic, monitoring, and backup coverage. In this Pre-deployment quality gate lab drill, the team must compare parameter-file values and prove no secret enters logs. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a safe recovery checklist with named operational owners. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 13

Scenario: A team is standardizing tags and resource naming in Bicep. In this Pre-deployment quality gate lab drill, the team must review what-if replacement/deletion lines against the data owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an evidence bundle with timestamps and correlation identifiers. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 14

Scenario: A pipeline must separate validation credentials from deployment identity. In this Pre-deployment quality gate lab drill, the team must verify scope and principal permissions before provider preflight. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a set of positive and negative tests for the declared boundary. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 15

Scenario: A management group deployment needs carefully scoped assignments. In this Pre-deployment quality gate lab drill, the team must identify API-version compatibility and the provider schema contract. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a compatibility note for consumers and a version migration plan. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 16

Scenario: A module change passes build but fails at provider validation. In this Pre-deployment quality gate lab drill, the team must define a canary, success signal, abort threshold and rollback owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a stop/go gate tied to measurable workload health. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 17

Scenario: An environment promotion must compare source and target configuration. In this Pre-deployment quality gate lab drill, the team must separate template-owned resources from existing and shared assets. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an annotated change plan and reviewer sign-off. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 18

Scenario: A team wants to test snapshots without querying live Azure. In this Pre-deployment quality gate lab drill, the team must record module version, lock-down source and artifact provenance. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a reproducible lab branch and validation transcript. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 19

Scenario: A production resource has immutable properties that cannot be replaced. In this Pre-deployment quality gate lab drill, the team must trace the resource dependency graph and name the owning module. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a decision record with an explicit rejected alternative. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 20

Scenario: A module uses experimental features without an upgrade owner. In this Pre-deployment quality gate lab drill, the team must compare parameter-file values and prove no secret enters logs. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a safe recovery checklist with named operational owners. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 21

Scenario: A cost review asks which resources a template owns. In this Pre-deployment quality gate lab drill, the team must review what-if replacement/deletion lines against the data owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an evidence bundle with timestamps and correlation identifiers. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 22

Scenario: A team needs an audited emergency deployment path. In this Pre-deployment quality gate lab drill, the team must verify scope and principal permissions before provider preflight. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a set of positive and negative tests for the declared boundary. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 23

Scenario: A public module dependency changes upstream behavior. In this Pre-deployment quality gate lab drill, the team must identify API-version compatibility and the provider schema contract. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a compatibility note for consumers and a version migration plan. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 24

Scenario: A resource group is created separately from its workload resources. In this Pre-deployment quality gate lab drill, the team must define a canary, success signal, abort threshold and rollback owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a stop/go gate tied to measurable workload health. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 25

Scenario: A cleanup request could remove shared networking by mistake. In this Pre-deployment quality gate lab drill, the team must separate template-owned resources from existing and shared assets. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an annotated change plan and reviewer sign-off. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 26

Scenario: A template has hard-coded environment names in several modules. In this Pre-deployment quality gate lab drill, the team must record module version, lock-down source and artifact provenance. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a reproducible lab branch and validation transcript. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 27

Scenario: A service team needs to roll back an API-version update. In this Pre-deployment quality gate lab drill, the team must trace the resource dependency graph and name the owning module. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a decision record with an explicit rejected alternative. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 28

Scenario: A deployment has a dependency cycle across modules. In this Pre-deployment quality gate lab drill, the team must compare parameter-file values and prove no secret enters logs. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a safe recovery checklist with named operational owners. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 29

Scenario: A template should adopt secure defaults without blocking exceptions. In this Pre-deployment quality gate lab drill, the team must review what-if replacement/deletion lines against the data owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an evidence bundle with timestamps and correlation identifiers. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 30

Scenario: An engineer needs to explain deployment history and correlation IDs. In this Pre-deployment quality gate lab drill, the team must verify scope and principal permissions before provider preflight. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a set of positive and negative tests for the declared boundary. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 31

Scenario: A team is splitting a monolithic template into ownership domains. In this Pre-deployment quality gate lab drill, the team must identify API-version compatibility and the provider schema contract. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a compatibility note for consumers and a version migration plan. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 32

Scenario: A release must support both cloud-hosted and private agents. In this Pre-deployment quality gate lab drill, the team must define a canary, success signal, abort threshold and rollback owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a stop/go gate tied to measurable workload health. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 33

Scenario: An environment has drift that must be reconciled before deployment. In this Pre-deployment quality gate lab drill, the team must separate template-owned resources from existing and shared assets. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an annotated change plan and reviewer sign-off. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 34

Scenario: A parameter-file change could expose secrets in source control. In this Pre-deployment quality gate lab drill, the team must record module version, lock-down source and artifact provenance. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a reproducible lab branch and validation transcript. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 35

Scenario: A policy assignment blocks an otherwise valid deployment. In this Pre-deployment quality gate lab drill, the team must trace the resource dependency graph and name the owning module. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a decision record with an explicit rejected alternative. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 36

Scenario: A stack deletion plan might detach or remove production assets. In this Pre-deployment quality gate lab drill, the team must compare parameter-file values and prove no secret enters logs. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a safe recovery checklist with named operational owners. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 37

Scenario: A product team is moving a manually configured web workload into version control. In this Pre-deployment quality gate lab drill, the team must review what-if replacement/deletion lines against the data owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an evidence bundle with timestamps and correlation identifiers. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 38

Scenario: A regulated payment service needs a separate production boundary. In this Pre-deployment quality gate lab drill, the team must verify scope and principal permissions before provider preflight. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a set of positive and negative tests for the declared boundary. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 39

Scenario: A platform team is publishing shared modules for dozens of teams. In this Pre-deployment quality gate lab drill, the team must identify API-version compatibility and the provider schema contract. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a compatibility note for consumers and a version migration plan. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 40

Scenario: An acquisition introduces existing subscriptions and naming rules. In this Pre-deployment quality gate lab drill, the team must define a canary, success signal, abort threshold and rollback owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a stop/go gate tied to measurable workload health. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 41

Scenario: A deployment must preserve an existing database and its data. In this Pre-deployment quality gate lab drill, the team must separate template-owned resources from existing and shared assets. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an annotated change plan and reviewer sign-off. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 42

Scenario: A pipeline currently uses a long-lived service-principal secret. In this Pre-deployment quality gate lab drill, the team must record module version, lock-down source and artifact provenance. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a reproducible lab branch and validation transcript. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 43

Scenario: A regional rollout needs consistent network and policy baselines. In this Pre-deployment quality gate lab drill, the team must trace the resource dependency graph and name the owning module. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a decision record with an explicit rejected alternative. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 44

Scenario: A deployment preview shows unexpected resource replacement. In this Pre-deployment quality gate lab drill, the team must compare parameter-file values and prove no secret enters logs. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a safe recovery checklist with named operational owners. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 45

Scenario: A team needs per-environment values without copying templates. In this Pre-deployment quality gate lab drill, the team must review what-if replacement/deletion lines against the data owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an evidence bundle with timestamps and correlation identifiers. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 46

Scenario: A resource provider API version changes its required property shape. In this Pre-deployment quality gate lab drill, the team must verify scope and principal permissions before provider preflight. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a set of positive and negative tests for the declared boundary. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 47

Scenario: An auditor needs reproducible evidence for each infrastructure change. In this Pre-deployment quality gate lab drill, the team must identify API-version compatibility and the provider schema contract. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a compatibility note for consumers and a version migration plan. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 48

Scenario: A shared module has breaking changes planned for a new release. In this Pre-deployment quality gate lab drill, the team must define a canary, success signal, abort threshold and rollback owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a stop/go gate tied to measurable workload health. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Deployment and ownership diagram

Git change → Bicep build / lint → validation → what-if review → scoped identity → ARM deployment → resource provider → activity/deployment evidence

Mark credential boundaries, approval ownership, correlation IDs and safe stop points at each transition.

Change sequence

1. Record desired state and affected owners

2. Build/lint locally and review the diff

3. Run validate and what-if at target scope

4. Approve and deploy in stages

5. Check resources, activity log and workload health

6. Retain evidence and rollback decision

Read-only and local commands

az bicep version
az bicep build --file main.bicep
az bicep lint --file main.bicep
az deployment group validate --resource-group <rg> --template-file main.bicep
az deployment group what-if --resource-group <rg> --template-file main.bicep
az deployment group show --resource-group <rg> --name <deployment-name>

Run az account show first to confirm tenant, subscription and principal. Validate and what-if can perform preflight checks and require read access; create/update commands submit writes. Production deployment requires reviewed authorization and change plan.

Guided lab / 指导实验

Goal: deliver an auditable Bicep change for Pre-deployment quality gate lab. (1) Use a sandbox subscription/resource group and confirm caller identity. (2) Copy the sample into a Git branch. (3) express environment differences in parameter files rather than template copies. (4) build, lint and validate. (5) retain what-if output and explain Create/Modify/Delete/NoChange/Ignore line by line. (6) deploy only in the approved lab scope. (7) verify with Azure queries and workload probes. (8) if preview and outcome diverge, stop and retain deployment operations, correlation ID and activity log. Deliver Bicep, sample parameters, preview, verification evidence and rollback note.

Acceptance rubric / 验收标准

Pass only when the template builds, lint findings are dispositioned, parameter and identity boundaries are explicit, what-if has no unexplained destructive change, and deployment output is independently verified.

Production readiness / 生产就绪评审

Scenario: An auditor needs reproducible evidence for each infrastructure change. Review the production rollout for Pre-deployment quality gate lab. Submit maintenance window, blast radius, change owner, approver, concurrency policy, quota checks, diagnostics/alerts, rollback trigger, data recovery and business communication. Identify template-owned resources versus existing/external dependencies, consequences of delete or detach, and stop gates for API/module upgrade failure.

Failure-mode rehearsal / 故障演练

Run a tabletop for a denied role assignment, provider validation error, partial deployment, unexpected replacement, throttling and a broken health probe. Assign who stops rollout, who gathers evidence, who restores the last known-good declaration and who communicates status.

Evidence-first troubleshooting / 证据优先排错

For a Pre-deployment quality gate lab failure, pause retries and automatic promotion. Record commit, CLI/Bicep versions, tenant/subscription/resource group, deployment name and time. Inspect deployment operations, error code, target resource, correlation ID and Activity Log; classify as compiler/type, ARM preflight, RBAC/policy, provider/quota, dependency/runtime or pipeline artifact issue. Preserve raw responses; never use broad permissions, disabled policy or Complete mode as a generic fix.

Knowledge check / 知识检查

Question 1: Pre-deployment quality gate lab — what evidence should an engineer inspect before changing the template?

State scope, intended state, authorization, API version, dependencies, preview and verification; include observable evidence and rollback conditions.

Question 2: Pre-deployment quality gate lab — what evidence should an engineer inspect before changing the template?

State scope, intended state, authorization, API version, dependencies, preview and verification; include observable evidence and rollback conditions.

Question 3: Pre-deployment quality gate lab — what evidence should an engineer inspect before changing the template?

State scope, intended state, authorization, API version, dependencies, preview and verification; include observable evidence and rollback conditions.

Question 4: Pre-deployment quality gate lab — what evidence should an engineer inspect before changing the template?

State scope, intended state, authorization, API version, dependencies, preview and verification; include observable evidence and rollback conditions.

Question 5: Pre-deployment quality gate lab — what evidence should an engineer inspect before changing the template?

State scope, intended state, authorization, API version, dependencies, preview and verification; include observable evidence and rollback conditions.

Instructor narration / 讲师讲解提纲

Explain the business value of Pre-deployment quality gate lab in five minutes. Ask learners to identify state ownership, then draw inputs, resource graph, authorization path and verification evidence. Have a peer act as change approver and challenge destructive differences, secret handling and rollback ownership. Each learner closes with one verified fact, one assumption and one sandbox-safe validation.

Next →

Review a change plan

Hour 7 · Module 8 · 7 min
BicepAzure Resource ManagerEnglish original · Source of truth for the Chinese translation. Verified against current Microsoft Learn documentation.

Core model

Build confidence before deployment with compiler diagnostics, linter rules, ARM validation, snapshot testing and what-if interpretation.

This module uses Review a change plan to connect language syntax, ARM evaluation, provider behavior and team ownership. Before writing declarations, identify target scope, resource owner, input source, dependency edges, observable evidence and recovery action.

Key principle: Bicep compiles to ARM JSON and Azure Resource Manager orchestrates resource state. Repeatability is not a safety guarantee; API versions, mutability, external dependencies and authorization still require independent review.

Worked Bicep example

param keyVaultName string

resource vault 'Microsoft.KeyVault/vaults@2023-07-01' existing = {
  name: keyVaultName
}

@secure()
param bootstrapSecret string

output vaultResourceId string = vault.id

Trace targetScope, parameter provenance, symbolic references, implicit dependencies and output contract. Validate names, API versions and properties against the target environment and current provider schema.

Design review / 设计评审

Review questions: Who owns Review a change plan? Can callers infer defaults? Are inputs constrained by types? What happens on redeploy, manual drift, concurrent change or retry? Could an immutable property replace production data? How can deployment evidence be retained without exposing secrets?

Self-paced practice: choose one or two clinics; the hour schedule is not intended to complete every prompt.

Architecture clinic 1

Scenario: A shared platform module has no clear deprecation policy. In this Review a change plan drill, the team must record module version, lock-down source and artifact provenance. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an annotated change plan and reviewer sign-off. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 2

Scenario: A stack uses deny settings that could block child resource changes. In this Review a change plan drill, the team must trace the resource dependency graph and name the owning module. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a reproducible lab branch and validation transcript. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 3

Scenario: A resource is supported only in selected Azure regions. In this Review a change plan drill, the team must compare parameter-file values and prove no secret enters logs. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a decision record with an explicit rejected alternative. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 4

Scenario: A team must restore a prior configuration after a faulty change. In this Review a change plan drill, the team must review what-if replacement/deletion lines against the data owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a safe recovery checklist with named operational owners. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 5

Scenario: A deployment uses a Key Vault reference from another subscription. In this Review a change plan drill, the team must verify scope and principal permissions before provider preflight. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an evidence bundle with timestamps and correlation identifiers. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 6

Scenario: A module output accidentally exposes a sensitive endpoint token. In this Review a change plan drill, the team must identify API-version compatibility and the provider schema contract. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a set of positive and negative tests for the declared boundary. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 7

Scenario: A new service needs diagnostic, monitoring, and backup coverage. In this Review a change plan drill, the team must define a canary, success signal, abort threshold and rollback owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a compatibility note for consumers and a version migration plan. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 8

Scenario: A team is standardizing tags and resource naming in Bicep. In this Review a change plan drill, the team must separate template-owned resources from existing and shared assets. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a stop/go gate tied to measurable workload health. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 9

Scenario: A pipeline must separate validation credentials from deployment identity. In this Review a change plan drill, the team must record module version, lock-down source and artifact provenance. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an annotated change plan and reviewer sign-off. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 10

Scenario: A management group deployment needs carefully scoped assignments. In this Review a change plan drill, the team must trace the resource dependency graph and name the owning module. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a reproducible lab branch and validation transcript. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 11

Scenario: A module change passes build but fails at provider validation. In this Review a change plan drill, the team must compare parameter-file values and prove no secret enters logs. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a decision record with an explicit rejected alternative. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 12

Scenario: An environment promotion must compare source and target configuration. In this Review a change plan drill, the team must review what-if replacement/deletion lines against the data owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a safe recovery checklist with named operational owners. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 13

Scenario: A team wants to test snapshots without querying live Azure. In this Review a change plan drill, the team must verify scope and principal permissions before provider preflight. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an evidence bundle with timestamps and correlation identifiers. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 14

Scenario: A production resource has immutable properties that cannot be replaced. In this Review a change plan drill, the team must identify API-version compatibility and the provider schema contract. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a set of positive and negative tests for the declared boundary. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 15

Scenario: A module uses experimental features without an upgrade owner. In this Review a change plan drill, the team must define a canary, success signal, abort threshold and rollback owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a compatibility note for consumers and a version migration plan. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 16

Scenario: A cost review asks which resources a template owns. In this Review a change plan drill, the team must separate template-owned resources from existing and shared assets. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a stop/go gate tied to measurable workload health. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 17

Scenario: A team needs an audited emergency deployment path. In this Review a change plan drill, the team must record module version, lock-down source and artifact provenance. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an annotated change plan and reviewer sign-off. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 18

Scenario: A public module dependency changes upstream behavior. In this Review a change plan drill, the team must trace the resource dependency graph and name the owning module. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a reproducible lab branch and validation transcript. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 19

Scenario: A resource group is created separately from its workload resources. In this Review a change plan drill, the team must compare parameter-file values and prove no secret enters logs. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a decision record with an explicit rejected alternative. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 20

Scenario: A cleanup request could remove shared networking by mistake. In this Review a change plan drill, the team must review what-if replacement/deletion lines against the data owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a safe recovery checklist with named operational owners. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 21

Scenario: A template has hard-coded environment names in several modules. In this Review a change plan drill, the team must verify scope and principal permissions before provider preflight. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an evidence bundle with timestamps and correlation identifiers. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 22

Scenario: A service team needs to roll back an API-version update. In this Review a change plan drill, the team must identify API-version compatibility and the provider schema contract. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a set of positive and negative tests for the declared boundary. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 23

Scenario: A deployment has a dependency cycle across modules. In this Review a change plan drill, the team must define a canary, success signal, abort threshold and rollback owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a compatibility note for consumers and a version migration plan. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 24

Scenario: A template should adopt secure defaults without blocking exceptions. In this Review a change plan drill, the team must separate template-owned resources from existing and shared assets. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a stop/go gate tied to measurable workload health. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 25

Scenario: An engineer needs to explain deployment history and correlation IDs. In this Review a change plan drill, the team must record module version, lock-down source and artifact provenance. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an annotated change plan and reviewer sign-off. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 26

Scenario: A team is splitting a monolithic template into ownership domains. In this Review a change plan drill, the team must trace the resource dependency graph and name the owning module. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a reproducible lab branch and validation transcript. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 27

Scenario: A release must support both cloud-hosted and private agents. In this Review a change plan drill, the team must compare parameter-file values and prove no secret enters logs. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a decision record with an explicit rejected alternative. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 28

Scenario: An environment has drift that must be reconciled before deployment. In this Review a change plan drill, the team must review what-if replacement/deletion lines against the data owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a safe recovery checklist with named operational owners. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 29

Scenario: A parameter-file change could expose secrets in source control. In this Review a change plan drill, the team must verify scope and principal permissions before provider preflight. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an evidence bundle with timestamps and correlation identifiers. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 30

Scenario: A policy assignment blocks an otherwise valid deployment. In this Review a change plan drill, the team must identify API-version compatibility and the provider schema contract. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a set of positive and negative tests for the declared boundary. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 31

Scenario: A stack deletion plan might detach or remove production assets. In this Review a change plan drill, the team must define a canary, success signal, abort threshold and rollback owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a compatibility note for consumers and a version migration plan. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 32

Scenario: A product team is moving a manually configured web workload into version control. In this Review a change plan drill, the team must separate template-owned resources from existing and shared assets. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a stop/go gate tied to measurable workload health. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 33

Scenario: A regulated payment service needs a separate production boundary. In this Review a change plan drill, the team must record module version, lock-down source and artifact provenance. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an annotated change plan and reviewer sign-off. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 34

Scenario: A platform team is publishing shared modules for dozens of teams. In this Review a change plan drill, the team must trace the resource dependency graph and name the owning module. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a reproducible lab branch and validation transcript. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 35

Scenario: An acquisition introduces existing subscriptions and naming rules. In this Review a change plan drill, the team must compare parameter-file values and prove no secret enters logs. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a decision record with an explicit rejected alternative. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 36

Scenario: A deployment must preserve an existing database and its data. In this Review a change plan drill, the team must review what-if replacement/deletion lines against the data owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a safe recovery checklist with named operational owners. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 37

Scenario: A pipeline currently uses a long-lived service-principal secret. In this Review a change plan drill, the team must verify scope and principal permissions before provider preflight. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an evidence bundle with timestamps and correlation identifiers. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 38

Scenario: A regional rollout needs consistent network and policy baselines. In this Review a change plan drill, the team must identify API-version compatibility and the provider schema contract. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a set of positive and negative tests for the declared boundary. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 39

Scenario: A deployment preview shows unexpected resource replacement. In this Review a change plan drill, the team must define a canary, success signal, abort threshold and rollback owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a compatibility note for consumers and a version migration plan. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 40

Scenario: A team needs per-environment values without copying templates. In this Review a change plan drill, the team must separate template-owned resources from existing and shared assets. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a stop/go gate tied to measurable workload health. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 41

Scenario: A resource provider API version changes its required property shape. In this Review a change plan drill, the team must record module version, lock-down source and artifact provenance. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an annotated change plan and reviewer sign-off. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 42

Scenario: An auditor needs reproducible evidence for each infrastructure change. In this Review a change plan drill, the team must trace the resource dependency graph and name the owning module. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a reproducible lab branch and validation transcript. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 43

Scenario: A shared module has breaking changes planned for a new release. In this Review a change plan drill, the team must compare parameter-file values and prove no secret enters logs. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a decision record with an explicit rejected alternative. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 44

Scenario: A policy denies public endpoints but a legacy system depends on one. In this Review a change plan drill, the team must review what-if replacement/deletion lines against the data owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a safe recovery checklist with named operational owners. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 45

Scenario: A team needs separate owners for subscription and workload resources. In this Review a change plan drill, the team must verify scope and principal permissions before provider preflight. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: an evidence bundle with timestamps and correlation identifiers. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 46

Scenario: A failed pipeline leaves a partially completed deployment. In this Review a change plan drill, the team must identify API-version compatibility and the provider schema contract. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a set of positive and negative tests for the declared boundary. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 47

Scenario: A development environment must be safely torn down every sprint. In this Review a change plan drill, the team must define a canary, success signal, abort threshold and rollback owner. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a compatibility note for consumers and a version migration plan. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Architecture clinic 48

Scenario: A production change must pass review before any write operation. In this Review a change plan drill, the team must separate template-owned resources from existing and shared assets. Identify affected resources and owners, observable facts, unknown assumptions and user impact on failure. Explain the chosen scope/parameter/module contract, add one counterexample test and a stop condition. Deliverable: a stop/go gate tied to measurable workload health. A peer reviewer challenges accidental shared-resource deletion, excessive privilege, secret exposure and environment drift.

Deployment and ownership diagram

Git change → Bicep build / lint → validation → what-if review → scoped identity → ARM deployment → resource provider → activity/deployment evidence

Mark credential boundaries, approval ownership, correlation IDs and safe stop points at each transition.

Change sequence

1. Record desired state and affected owners

2. Build/lint locally and review the diff

3. Run validate and what-if at target scope

4. Approve and deploy in stages

5. Check resources, activity log and workload health

6. Retain evidence and rollback decision

Read-only and local commands

az bicep version
az bicep build --file main.bicep
az bicep lint --file main.bicep
az deployment group validate --resource-group <rg> --template-file main.bicep
az deployment group what-if --resource-group <rg> --template-file main.bicep
az deployment group show --resource-group <rg> --name <deployment-name>

Run az account show first to confirm tenant, subscription and principal. Validate and what-if can perform preflight checks and require read access; create/update commands submit writes. Production deployment requires reviewed authorization and change plan.

Guided lab / 指导实验

Goal: deliver an auditable Bicep change for Review a change plan. (1) Use a sandbox subscription/resource group and confirm caller identity. (2) Copy the sample into a Git branch. (3) express environment differences in parameter files rather than template copies. (4) build, lint and validate. (5) retain what-if output and explain Create/Modify/Delete/NoChange/Ignore line by line. (6) deploy only in the approved lab scope. (7) verify with Azure queries and workload probes. (8) if preview and outcome diverge, stop and retain deployment operations, correlation ID and activity log. Deliver Bicep, sample parameters, preview, verification evidence and rollback note.

Acceptance rubric / 验收标准

Pass only when the template builds, lint findings are dispositioned, parameter and identity boundaries are explicit, what-if has no unexplained destructive change, and deployment output is independently verified.

Production readiness / 生产就绪评审

Scenario: A team needs separate owners for subscription and workload resources. Review the production rollout for Review a change plan. Submit maintenance window, blast radius, change owner, approver, concurrency policy, quota checks, diagnostics/alerts, rollback trigger, data recovery and business communication. Identify template-owned resources versus existing/external dependencies, consequences of delete or detach, and stop gates for API/module upgrade failure.

Failure-mode rehearsal / 故障演练

Run a tabletop for a denied role assignment, provider validation error, partial deployment, unexpected replacement, throttling and a broken health probe. Assign who stops rollout, who gathers evidence, who restores the last known-good declaration and who communicates status.

Evidence-first troubleshooting / 证据优先排错

For a Review a change plan failure, pause retries and automatic promotion. Record commit, CLI/Bicep versions, tenant/subscription/resource group, deployment name and time. Inspect deployment operations, error code, target resource, correlation ID and Activity Log; classify as compiler/type, ARM preflight, RBAC/policy, provider/quota, dependency/runtime or pipeline artifact issue. Preserve raw responses; never use broad permissions, disabled policy or Complete mode as a generic fix.

Knowledge check / 知识检查

Question 1: Review a change plan — what evidence should an engineer inspect before changing the template?

State scope, intended state, authorization, API version, dependencies, preview and verification; include observable evidence and rollback conditions.

Question 2: Review a change plan — what evidence should an engineer inspect before changing the template?

State scope, intended state, authorization, API version, dependencies, preview and verification; include observable evidence and rollback conditions.

Question 3: Review a change plan — what evidence should an engineer inspect before changing the template?

State scope, intended state, authorization, API version, dependencies, preview and verification; include observable evidence and rollback conditions.

Question 4: Review a change plan — what evidence should an engineer inspect before changing the template?

State scope, intended state, authorization, API version, dependencies, preview and verification; include observable evidence and rollback conditions.

Question 5: Review a change plan — what evidence should an engineer inspect before changing the template?

State scope, intended state, authorization, API version, dependencies, preview and verification; include observable evidence and rollback conditions.

Instructor narration / 讲师讲解提纲

Explain the business value of Review a change plan in five minutes. Ask learners to identify state ownership, then draw inputs, resource graph, authorization path and verification evidence. Have a peer act as change approver and challenge destructive differences, secret handling and rollback ownership. Each learner closes with one verified fact, one assumption and one sandbox-safe validation.

Hour check →

Hour knowledge check / 课时综合检查

1. Describe the ARM deployment lifecycle and explain what Bicep compiles to.

Bicep compiles declarative source to ARM JSON; ARM evaluates the deployment at the declared scope, calls resource providers and records operations.

2. How do parameter types and decorators make an environment contract safer?

Use typed inputs, allowed values and secure decorators where appropriate; keep environment differences in parameter files and review provenance.

3. When is an implicit dependency enough, and when is dependsOn justified?

A symbolic reference creates an implicit dependency when one resource consumes another output; use dependsOn only for ordering without a data reference.

4. What belongs in a reusable module interface and how should its version evolve?

Keep a small typed parameter/output contract, minimize hidden side effects, pin registry versions and document breaking-change migration.

5. How do targetScope, module scope and deployment identity interact?

The root targetScope constrains deployment scope; child modules can target supported scopes, but the caller identity needs permissions at every target.

6. How do you supply secrets without embedding or logging secret values?

Use secure parameters or supported Key Vault parameter references with a least-privilege deployment identity; avoid defaults, outputs and logs containing secrets.

7. What does each of build, lint, validate, what-if and snapshot testing establish?

Build checks compilation, lint checks configured style/security rules, validate runs ARM preflight, what-if predicts change and snapshots compare normalized local representations.

8. How do you gate a federated pipeline and recover from a partial release?

Use workload identity federation, scoped environments, reviewed what-if, canary health gates and a named rollback owner; inspect operations before retrying.

Field checklist / 实战清单

  1. Build, restore and diagnostics: build, lint, review scope, validate, inspect what-if, deploy only after approval, verify and retain evidence.
  2. Linter rules and configuration: build, lint, review scope, validate, inspect what-if, deploy only after approval, verify and retain evidence.
  3. Validate versus what-if: build, lint, review scope, validate, inspect what-if, deploy only after approval, verify and retain evidence.
  4. What-if change types and limits: build, lint, review scope, validate, inspect what-if, deploy only after approval, verify and retain evidence.
  5. Snapshot testing and normalized templates: build, lint, review scope, validate, inspect what-if, deploy only after approval, verify and retain evidence.
  6. Negative and policy tests: build, lint, review scope, validate, inspect what-if, deploy only after approval, verify and retain evidence.
  7. Pre-deployment quality gate lab: build, lint, review scope, validate, inspect what-if, deploy only after approval, verify and retain evidence.
  8. Review a change plan: build, lint, review scope, validate, inspect what-if, deploy only after approval, verify and retain evidence.

Official Microsoft Learn references

Check current CLI, Bicep and resource API versions before applying examples.