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

Language Fundamentals, Types and Configuration

Write maintainable Bicep with typed parameters, decorators, variables, outputs, user-defined types and functions, while applying a deliberate configuration policy.
BicepAzure Resource ManagerAzure CLIEnglish original · Source of truth for the Chinese translation. Verified against current Microsoft Learn documentation.
Learning outcomes / 学习目标
  • Parameters and allowed values — deliver a reviewed, validated change at the right scope
  • Variables, expressions and interpolation — deliver a reviewed, validated change at the right scope
  • Outputs and secret-safe contracts — deliver a reviewed, validated change at the right scope
  • Primitive, object and union types — deliver a reviewed, validated change at the right scope
  • Decorators and validation — deliver a reviewed, validated change at the right scope
  • Bicep configuration and linter rules — deliver a reviewed, validated change at the right scope
  • Typed application configuration lab — deliver a reviewed, validated change at the right scope
  • Refactor and review — 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
1Parameters and allowed values7
2Variables, expressions and interpolation7
3Outputs and secret-safe contracts7
4Primitive, object and union types7
5Decorators and validation7
6Bicep configuration and linter rules7
7Typed application configuration lab7
8Refactor and review7

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.

Parameters and allowed values

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

Core model

Write maintainable Bicep with typed parameters, decorators, variables, outputs, user-defined types and functions, while applying a deliberate configuration policy.

This module uses Parameters and allowed values 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 Parameters and allowed values? 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 Parameters and allowed values 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: A central team wants to enforce diagnostic settings consistently. In this Parameters and allowed values 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 deployment stack may delete resources removed from its template. In this Parameters and allowed values 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 module registry artifact is missing or inaccessible in CI. In this Parameters and allowed values 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 resource is changed manually after a successful deployment. In this Parameters and allowed values 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 what-if report contains many no-change and unsupported lines. In this Parameters and allowed values 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 pipeline needs to deploy to multiple subscriptions with OIDC. In this Parameters and allowed values 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 team is migrating a large ARM JSON template incrementally. In this Parameters and allowed values 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 compliance team needs a time-bounded exception process. In this Parameters and allowed values 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 deployment is close to subscription quota limits. In this Parameters and allowed values 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 shared platform module has no clear deprecation policy. In this Parameters and allowed values 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 stack uses deny settings that could block child resource changes. In this Parameters and allowed values 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 resource is supported only in selected Azure regions. In this Parameters and allowed values 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 team must restore a prior configuration after a faulty change. In this Parameters and allowed values 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 deployment uses a Key Vault reference from another subscription. In this Parameters and allowed values 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 module output accidentally exposes a sensitive endpoint token. In this Parameters and allowed values 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 new service needs diagnostic, monitoring, and backup coverage. In this Parameters and allowed values 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 standardizing tags and resource naming in Bicep. In this Parameters and allowed values 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 pipeline must separate validation credentials from deployment identity. In this Parameters and allowed values 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 management group deployment needs carefully scoped assignments. In this Parameters and allowed values 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 module change passes build but fails at provider validation. In this Parameters and allowed values 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: An environment promotion must compare source and target configuration. In this Parameters and allowed values 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 team wants to test snapshots without querying live Azure. In this Parameters and allowed values 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 production resource has immutable properties that cannot be replaced. In this Parameters and allowed values 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 module uses experimental features without an upgrade owner. In this Parameters and allowed values 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 cost review asks which resources a template owns. In this Parameters and allowed values 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 team needs an audited emergency deployment path. In this Parameters and allowed values 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 public module dependency changes upstream behavior. In this Parameters and allowed values 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 resource group is created separately from its workload resources. In this Parameters and allowed values 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 cleanup request could remove shared networking by mistake. In this Parameters and allowed values 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 template has hard-coded environment names in several modules. In this Parameters and allowed values 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: A service team needs to roll back an API-version update. In this Parameters and allowed values 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 deployment has a dependency cycle across modules. In this Parameters and allowed values 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 template should adopt secure defaults without blocking exceptions. In this Parameters and allowed values 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: An engineer needs to explain deployment history and correlation IDs. In this Parameters and allowed values 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 team is splitting a monolithic template into ownership domains. In this Parameters and allowed values 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 release must support both cloud-hosted and private agents. In this Parameters and allowed values 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: An environment has drift that must be reconciled before deployment. In this Parameters and allowed values 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 parameter-file change could expose secrets in source control. In this Parameters and allowed values 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 policy assignment blocks an otherwise valid deployment. In this Parameters and allowed values 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 stack deletion plan might detach or remove production assets. In this Parameters and allowed values 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 product team is moving a manually configured web workload into version control. In this Parameters and allowed values 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 regulated payment service needs a separate production boundary. In this Parameters and allowed values 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 platform team is publishing shared modules for dozens of teams. In this Parameters and allowed values 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 acquisition introduces existing subscriptions and naming rules. In this Parameters and allowed values 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 deployment must preserve an existing database and its data. In this Parameters and allowed values 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 pipeline currently uses a long-lived service-principal secret. In this Parameters and allowed values 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: A regional rollout needs consistent network and policy baselines. In this Parameters and allowed values 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 Parameters and allowed values. (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 nested module unexpectedly deploys to the wrong scope. Review the production rollout for Parameters and allowed values. 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 Parameters and allowed values 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: Parameters and allowed values — 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: Parameters and allowed values — 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: Parameters and allowed values — 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: Parameters and allowed values — 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: Parameters and allowed values — 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 Parameters and allowed values 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 →

Variables, expressions and interpolation

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

Core model

Write maintainable Bicep with typed parameters, decorators, variables, outputs, user-defined types and functions, while applying a deliberate configuration policy.

This module uses Variables, expressions and interpolation 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 Variables, expressions and interpolation? 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 Variables, expressions and interpolation 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 pipeline needs to deploy to multiple subscriptions with OIDC. In this Variables, expressions and interpolation 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 team is migrating a large ARM JSON template incrementally. In this Variables, expressions and interpolation 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 compliance team needs a time-bounded exception process. In this Variables, expressions and interpolation 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 deployment is close to subscription quota limits. In this Variables, expressions and interpolation 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 shared platform module has no clear deprecation policy. In this Variables, expressions and interpolation 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 stack uses deny settings that could block child resource changes. In this Variables, expressions and interpolation 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 resource is supported only in selected Azure regions. In this Variables, expressions and interpolation 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 team must restore a prior configuration after a faulty change. In this Variables, expressions and interpolation 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 deployment uses a Key Vault reference from another subscription. In this Variables, expressions and interpolation 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 module output accidentally exposes a sensitive endpoint token. In this Variables, expressions and interpolation 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 new service needs diagnostic, monitoring, and backup coverage. In this Variables, expressions and interpolation 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 standardizing tags and resource naming in Bicep. In this Variables, expressions and interpolation 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 pipeline must separate validation credentials from deployment identity. In this Variables, expressions and interpolation 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 management group deployment needs carefully scoped assignments. In this Variables, expressions and interpolation 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 module change passes build but fails at provider validation. In this Variables, expressions and interpolation 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: An environment promotion must compare source and target configuration. In this Variables, expressions and interpolation 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 team wants to test snapshots without querying live Azure. In this Variables, expressions and interpolation 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 production resource has immutable properties that cannot be replaced. In this Variables, expressions and interpolation 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 module uses experimental features without an upgrade owner. In this Variables, expressions and interpolation 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 cost review asks which resources a template owns. In this Variables, expressions and interpolation 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 team needs an audited emergency deployment path. In this Variables, expressions and interpolation 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 public module dependency changes upstream behavior. In this Variables, expressions and interpolation 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 resource group is created separately from its workload resources. In this Variables, expressions and interpolation 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 cleanup request could remove shared networking by mistake. In this Variables, expressions and interpolation 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 template has hard-coded environment names in several modules. In this Variables, expressions and interpolation 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: A service team needs to roll back an API-version update. In this Variables, expressions and interpolation 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 deployment has a dependency cycle across modules. In this Variables, expressions and interpolation 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 template should adopt secure defaults without blocking exceptions. In this Variables, expressions and interpolation 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: An engineer needs to explain deployment history and correlation IDs. In this Variables, expressions and interpolation 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 team is splitting a monolithic template into ownership domains. In this Variables, expressions and interpolation 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 release must support both cloud-hosted and private agents. In this Variables, expressions and interpolation 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: An environment has drift that must be reconciled before deployment. In this Variables, expressions and interpolation 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 parameter-file change could expose secrets in source control. In this Variables, expressions and interpolation 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 policy assignment blocks an otherwise valid deployment. In this Variables, expressions and interpolation 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 stack deletion plan might detach or remove production assets. In this Variables, expressions and interpolation 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 product team is moving a manually configured web workload into version control. In this Variables, expressions and interpolation 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 regulated payment service needs a separate production boundary. In this Variables, expressions and interpolation 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 platform team is publishing shared modules for dozens of teams. In this Variables, expressions and interpolation 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 acquisition introduces existing subscriptions and naming rules. In this Variables, expressions and interpolation 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 deployment must preserve an existing database and its data. In this Variables, expressions and interpolation 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 pipeline currently uses a long-lived service-principal secret. In this Variables, expressions and interpolation 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: A regional rollout needs consistent network and policy baselines. In this Variables, expressions and interpolation 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 deployment preview shows unexpected resource replacement. In this Variables, expressions and interpolation 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 team needs per-environment values without copying templates. In this Variables, expressions and interpolation 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 resource provider API version changes its required property shape. In this Variables, expressions and interpolation 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: An auditor needs reproducible evidence for each infrastructure change. In this Variables, expressions and interpolation 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 shared module has breaking changes planned for a new release. In this Variables, expressions and interpolation 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 Variables, expressions and interpolation. (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 central team wants to enforce diagnostic settings consistently. Review the production rollout for Variables, expressions and interpolation. 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 Variables, expressions and interpolation 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: Variables, expressions and interpolation — 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: Variables, expressions and interpolation — 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: Variables, expressions and interpolation — 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: Variables, expressions and interpolation — 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: Variables, expressions and interpolation — 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 Variables, expressions and interpolation 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 →

Outputs and secret-safe contracts

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

Core model

Write maintainable Bicep with typed parameters, decorators, variables, outputs, user-defined types and functions, while applying a deliberate configuration policy.

This module uses Outputs and secret-safe contracts 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 Outputs and secret-safe contracts? 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 Outputs and secret-safe contracts 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 stack uses deny settings that could block child resource changes. In this Outputs and secret-safe contracts 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 resource is supported only in selected Azure regions. In this Outputs and secret-safe contracts 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 team must restore a prior configuration after a faulty change. In this Outputs and secret-safe contracts 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 deployment uses a Key Vault reference from another subscription. In this Outputs and secret-safe contracts 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 module output accidentally exposes a sensitive endpoint token. In this Outputs and secret-safe contracts 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 new service needs diagnostic, monitoring, and backup coverage. In this Outputs and secret-safe contracts 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 standardizing tags and resource naming in Bicep. In this Outputs and secret-safe contracts 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 pipeline must separate validation credentials from deployment identity. In this Outputs and secret-safe contracts 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 management group deployment needs carefully scoped assignments. In this Outputs and secret-safe contracts 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 module change passes build but fails at provider validation. In this Outputs and secret-safe contracts 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: An environment promotion must compare source and target configuration. In this Outputs and secret-safe contracts 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 team wants to test snapshots without querying live Azure. In this Outputs and secret-safe contracts 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 production resource has immutable properties that cannot be replaced. In this Outputs and secret-safe contracts 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 module uses experimental features without an upgrade owner. In this Outputs and secret-safe contracts 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 cost review asks which resources a template owns. In this Outputs and secret-safe contracts 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 team needs an audited emergency deployment path. In this Outputs and secret-safe contracts 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 public module dependency changes upstream behavior. In this Outputs and secret-safe contracts 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 resource group is created separately from its workload resources. In this Outputs and secret-safe contracts 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 cleanup request could remove shared networking by mistake. In this Outputs and secret-safe contracts 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 template has hard-coded environment names in several modules. In this Outputs and secret-safe contracts 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: A service team needs to roll back an API-version update. In this Outputs and secret-safe contracts 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 deployment has a dependency cycle across modules. In this Outputs and secret-safe contracts 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 template should adopt secure defaults without blocking exceptions. In this Outputs and secret-safe contracts 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: An engineer needs to explain deployment history and correlation IDs. In this Outputs and secret-safe contracts 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 team is splitting a monolithic template into ownership domains. In this Outputs and secret-safe contracts 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 release must support both cloud-hosted and private agents. In this Outputs and secret-safe contracts 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: An environment has drift that must be reconciled before deployment. In this Outputs and secret-safe contracts 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 parameter-file change could expose secrets in source control. In this Outputs and secret-safe contracts 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 policy assignment blocks an otherwise valid deployment. In this Outputs and secret-safe contracts 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 stack deletion plan might detach or remove production assets. In this Outputs and secret-safe contracts 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 product team is moving a manually configured web workload into version control. In this Outputs and secret-safe contracts 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 regulated payment service needs a separate production boundary. In this Outputs and secret-safe contracts 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 platform team is publishing shared modules for dozens of teams. In this Outputs and secret-safe contracts 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 acquisition introduces existing subscriptions and naming rules. In this Outputs and secret-safe contracts 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 deployment must preserve an existing database and its data. In this Outputs and secret-safe contracts 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 pipeline currently uses a long-lived service-principal secret. In this Outputs and secret-safe contracts 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: A regional rollout needs consistent network and policy baselines. In this Outputs and secret-safe contracts 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 deployment preview shows unexpected resource replacement. In this Outputs and secret-safe contracts 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 team needs per-environment values without copying templates. In this Outputs and secret-safe contracts 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 resource provider API version changes its required property shape. In this Outputs and secret-safe contracts 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: An auditor needs reproducible evidence for each infrastructure change. In this Outputs and secret-safe contracts 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 shared module has breaking changes planned for a new release. In this Outputs and secret-safe contracts 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 policy denies public endpoints but a legacy system depends on one. In this Outputs and secret-safe contracts 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: A team needs separate owners for subscription and workload resources. In this Outputs and secret-safe contracts 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 failed pipeline leaves a partially completed deployment. In this Outputs and secret-safe contracts 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 development environment must be safely torn down every sprint. In this Outputs and secret-safe contracts 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 production change must pass review before any write operation. In this Outputs and secret-safe contracts 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 Outputs and secret-safe contracts. (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 resource is changed manually after a successful deployment. Review the production rollout for Outputs and secret-safe contracts. 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 Outputs and secret-safe contracts 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: Outputs and secret-safe contracts — 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: Outputs and secret-safe contracts — 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: Outputs and secret-safe contracts — 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: Outputs and secret-safe contracts — 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: Outputs and secret-safe contracts — 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 Outputs and secret-safe contracts 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 →

Primitive, object and union types

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

Core model

Write maintainable Bicep with typed parameters, decorators, variables, outputs, user-defined types and functions, while applying a deliberate configuration policy.

This module uses Primitive, object and union types 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 Primitive, object and union types? 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 module output accidentally exposes a sensitive endpoint token. In this Primitive, object and union types 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 new service needs diagnostic, monitoring, and backup coverage. In this Primitive, object and union types 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 standardizing tags and resource naming in Bicep. In this Primitive, object and union types 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 pipeline must separate validation credentials from deployment identity. In this Primitive, object and union types 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 management group deployment needs carefully scoped assignments. In this Primitive, object and union types 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 module change passes build but fails at provider validation. In this Primitive, object and union types 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: An environment promotion must compare source and target configuration. In this Primitive, object and union types 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 team wants to test snapshots without querying live Azure. In this Primitive, object and union types 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 production resource has immutable properties that cannot be replaced. In this Primitive, object and union types 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 module uses experimental features without an upgrade owner. In this Primitive, object and union types 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 cost review asks which resources a template owns. In this Primitive, object and union types 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 team needs an audited emergency deployment path. In this Primitive, object and union types 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 public module dependency changes upstream behavior. In this Primitive, object and union types 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 resource group is created separately from its workload resources. In this Primitive, object and union types 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 cleanup request could remove shared networking by mistake. In this Primitive, object and union types 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 template has hard-coded environment names in several modules. In this Primitive, object and union types 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: A service team needs to roll back an API-version update. In this Primitive, object and union types 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 deployment has a dependency cycle across modules. In this Primitive, object and union types 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 template should adopt secure defaults without blocking exceptions. In this Primitive, object and union types 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: An engineer needs to explain deployment history and correlation IDs. In this Primitive, object and union types 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 team is splitting a monolithic template into ownership domains. In this Primitive, object and union types 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 release must support both cloud-hosted and private agents. In this Primitive, object and union types 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: An environment has drift that must be reconciled before deployment. In this Primitive, object and union types 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 parameter-file change could expose secrets in source control. In this Primitive, object and union types 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 policy assignment blocks an otherwise valid deployment. In this Primitive, object and union types 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 stack deletion plan might detach or remove production assets. In this Primitive, object and union types 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 product team is moving a manually configured web workload into version control. In this Primitive, object and union types 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 regulated payment service needs a separate production boundary. In this Primitive, object and union types 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 platform team is publishing shared modules for dozens of teams. In this Primitive, object and union types 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 acquisition introduces existing subscriptions and naming rules. In this Primitive, object and union types 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 deployment must preserve an existing database and its data. In this Primitive, object and union types 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 pipeline currently uses a long-lived service-principal secret. In this Primitive, object and union types 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: A regional rollout needs consistent network and policy baselines. In this Primitive, object and union types 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 deployment preview shows unexpected resource replacement. In this Primitive, object and union types 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 team needs per-environment values without copying templates. In this Primitive, object and union types 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 resource provider API version changes its required property shape. In this Primitive, object and union types 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: An auditor needs reproducible evidence for each infrastructure change. In this Primitive, object and union types 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 shared module has breaking changes planned for a new release. In this Primitive, object and union types 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 policy denies public endpoints but a legacy system depends on one. In this Primitive, object and union types 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: A team needs separate owners for subscription and workload resources. In this Primitive, object and union types 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 failed pipeline leaves a partially completed deployment. In this Primitive, object and union types 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 development environment must be safely torn down every sprint. In this Primitive, object and union types 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 production change must pass review before any write operation. In this Primitive, object and union types 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 nested module unexpectedly deploys to the wrong scope. In this Primitive, object and union types 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 template contains a secret copied from a local parameter file. In this Primitive, object and union types 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 release introduces a naming collision in one environment. In this Primitive, object and union types 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: A central team wants to enforce diagnostic settings consistently. In this Primitive, object and union types 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 deployment stack may delete resources removed from its template. In this Primitive, object and union types 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 Primitive, object and union types. (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 is migrating a large ARM JSON template incrementally. Review the production rollout for Primitive, object and union types. 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 Primitive, object and union types 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: Primitive, object and union types — 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: Primitive, object and union types — 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: Primitive, object and union types — 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: Primitive, object and union types — 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: Primitive, object and union types — 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 Primitive, object and union types 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 →

Decorators and validation

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

Core model

Write maintainable Bicep with typed parameters, decorators, variables, outputs, user-defined types and functions, while applying a deliberate configuration policy.

This module uses Decorators and validation 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 Decorators and validation? 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 module change passes build but fails at provider validation. In this Decorators and validation 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: An environment promotion must compare source and target configuration. In this Decorators and validation 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 team wants to test snapshots without querying live Azure. In this Decorators and validation 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 production resource has immutable properties that cannot be replaced. In this Decorators and validation 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 module uses experimental features without an upgrade owner. In this Decorators and validation 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 cost review asks which resources a template owns. In this Decorators and validation 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 team needs an audited emergency deployment path. In this Decorators and validation 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 public module dependency changes upstream behavior. In this Decorators and validation 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 resource group is created separately from its workload resources. In this Decorators and validation 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 cleanup request could remove shared networking by mistake. In this Decorators and validation 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 template has hard-coded environment names in several modules. In this Decorators and validation 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: A service team needs to roll back an API-version update. In this Decorators and validation 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 deployment has a dependency cycle across modules. In this Decorators and validation 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 template should adopt secure defaults without blocking exceptions. In this Decorators and validation 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: An engineer needs to explain deployment history and correlation IDs. In this Decorators and validation 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 team is splitting a monolithic template into ownership domains. In this Decorators and validation 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 release must support both cloud-hosted and private agents. In this Decorators and validation 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: An environment has drift that must be reconciled before deployment. In this Decorators and validation 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 parameter-file change could expose secrets in source control. In this Decorators and validation 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 policy assignment blocks an otherwise valid deployment. In this Decorators and validation 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 stack deletion plan might detach or remove production assets. In this Decorators and validation 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 product team is moving a manually configured web workload into version control. In this Decorators and validation 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 regulated payment service needs a separate production boundary. In this Decorators and validation 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 platform team is publishing shared modules for dozens of teams. In this Decorators and validation 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 acquisition introduces existing subscriptions and naming rules. In this Decorators and validation 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 deployment must preserve an existing database and its data. In this Decorators and validation 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 pipeline currently uses a long-lived service-principal secret. In this Decorators and validation 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: A regional rollout needs consistent network and policy baselines. In this Decorators and validation 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 deployment preview shows unexpected resource replacement. In this Decorators and validation 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 team needs per-environment values without copying templates. In this Decorators and validation 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 resource provider API version changes its required property shape. In this Decorators and validation 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: An auditor needs reproducible evidence for each infrastructure change. In this Decorators and validation 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 shared module has breaking changes planned for a new release. In this Decorators and validation 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 policy denies public endpoints but a legacy system depends on one. In this Decorators and validation 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: A team needs separate owners for subscription and workload resources. In this Decorators and validation 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 failed pipeline leaves a partially completed deployment. In this Decorators and validation 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 development environment must be safely torn down every sprint. In this Decorators and validation 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 production change must pass review before any write operation. In this Decorators and validation 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 nested module unexpectedly deploys to the wrong scope. In this Decorators and validation 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 template contains a secret copied from a local parameter file. In this Decorators and validation 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 release introduces a naming collision in one environment. In this Decorators and validation 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: A central team wants to enforce diagnostic settings consistently. In this Decorators and validation 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 deployment stack may delete resources removed from its template. In this Decorators and validation 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 module registry artifact is missing or inaccessible in CI. In this Decorators and validation 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 resource is changed manually after a successful deployment. In this Decorators and validation 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 what-if report contains many no-change and unsupported lines. In this Decorators and validation 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 pipeline needs to deploy to multiple subscriptions with OIDC. In this Decorators and validation 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 team is migrating a large ARM JSON template incrementally. In this Decorators and validation 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 Decorators and validation. (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 shared platform module has no clear deprecation policy. Review the production rollout for Decorators and validation. 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 Decorators and validation 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: Decorators and validation — 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: Decorators and validation — 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: Decorators and validation — 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: Decorators and validation — 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: Decorators and validation — 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 Decorators and validation 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 →

Bicep configuration and linter rules

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

Core model

Write maintainable Bicep with typed parameters, decorators, variables, outputs, user-defined types and functions, while applying a deliberate configuration policy.

This module uses Bicep configuration and linter rules 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 Bicep configuration and linter rules? 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 cost review asks which resources a template owns. In this Bicep configuration and linter rules 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 team needs an audited emergency deployment path. In this Bicep configuration and linter rules 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: A public module dependency changes upstream behavior. In this Bicep configuration and linter rules 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 resource group is created separately from its workload resources. In this Bicep configuration and linter rules 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 cleanup request could remove shared networking by mistake. In this Bicep configuration and linter rules 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 template has hard-coded environment names in several modules. In this Bicep configuration and linter rules 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 service team needs to roll back an API-version update. In this Bicep configuration and linter rules 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 deployment has a dependency cycle across modules. In this Bicep configuration and linter rules 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 template should adopt secure defaults without blocking exceptions. In this Bicep configuration and linter rules 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 engineer needs to explain deployment history and correlation IDs. In this Bicep configuration and linter rules 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 team is splitting a monolithic template into ownership domains. In this Bicep configuration and linter rules 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 release must support both cloud-hosted and private agents. In this Bicep configuration and linter rules 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: An environment has drift that must be reconciled before deployment. In this Bicep configuration and linter rules 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 parameter-file change could expose secrets in source control. In this Bicep configuration and linter rules 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 policy assignment blocks an otherwise valid deployment. In this Bicep configuration and linter rules 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 stack deletion plan might detach or remove production assets. In this Bicep configuration and linter rules 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: A product team is moving a manually configured web workload into version control. In this Bicep configuration and linter rules 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 regulated payment service needs a separate production boundary. In this Bicep configuration and linter rules 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 platform team is publishing shared modules for dozens of teams. In this Bicep configuration and linter rules 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: An acquisition introduces existing subscriptions and naming rules. In this Bicep configuration and linter rules 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 deployment must preserve an existing database and its data. In this Bicep configuration and linter rules 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 pipeline currently uses a long-lived service-principal secret. In this Bicep configuration and linter rules 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 regional rollout needs consistent network and policy baselines. In this Bicep configuration and linter rules 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 deployment preview shows unexpected resource replacement. In this Bicep configuration and linter rules 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 team needs per-environment values without copying templates. In this Bicep configuration and linter rules 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 resource provider API version changes its required property shape. In this Bicep configuration and linter rules 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: An auditor needs reproducible evidence for each infrastructure change. In this Bicep configuration and linter rules 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 shared module has breaking changes planned for a new release. In this Bicep configuration and linter rules 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 policy denies public endpoints but a legacy system depends on one. In this Bicep configuration and linter rules 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 team needs separate owners for subscription and workload resources. In this Bicep configuration and linter rules 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 failed pipeline leaves a partially completed deployment. In this Bicep configuration and linter rules 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 development environment must be safely torn down every sprint. In this Bicep configuration and linter rules 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 production change must pass review before any write operation. In this Bicep configuration and linter rules 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 nested module unexpectedly deploys to the wrong scope. In this Bicep configuration and linter rules 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 template contains a secret copied from a local parameter file. In this Bicep configuration and linter rules 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 release introduces a naming collision in one environment. In this Bicep configuration and linter rules 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 central team wants to enforce diagnostic settings consistently. In this Bicep configuration and linter rules 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 deployment stack may delete resources removed from its template. In this Bicep configuration and linter rules 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 module registry artifact is missing or inaccessible in CI. In this Bicep configuration and linter rules 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 resource is changed manually after a successful deployment. In this Bicep configuration and linter rules 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 what-if report contains many no-change and unsupported lines. In this Bicep configuration and linter rules 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 pipeline needs to deploy to multiple subscriptions with OIDC. In this Bicep configuration and linter rules 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 migrating a large ARM JSON template incrementally. In this Bicep configuration and linter rules 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 compliance team needs a time-bounded exception process. In this Bicep configuration and linter rules 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 deployment is close to subscription quota limits. In this Bicep configuration and linter rules 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 shared platform module has no clear deprecation policy. In this Bicep configuration and linter rules 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: A stack uses deny settings that could block child resource changes. In this Bicep configuration and linter rules 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 resource is supported only in selected Azure regions. In this Bicep configuration and linter rules 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 Bicep configuration and linter rules. (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 must restore a prior configuration after a faulty change. Review the production rollout for Bicep configuration and linter rules. 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 Bicep configuration and linter rules 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: Bicep configuration and linter rules — 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: Bicep configuration and linter rules — 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: Bicep configuration and linter rules — 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: Bicep configuration and linter rules — 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: Bicep configuration and linter rules — 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 Bicep configuration and linter rules 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 →

Typed application configuration lab

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

Core model

Write maintainable Bicep with typed parameters, decorators, variables, outputs, user-defined types and functions, while applying a deliberate configuration policy.

This module uses Typed application configuration 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

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 Typed application configuration 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 template has hard-coded environment names in several modules. In this Typed application configuration 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: 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 service team needs to roll back an API-version update. In this Typed application configuration 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: 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 has a dependency cycle across modules. In this Typed application configuration 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 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 template should adopt secure defaults without blocking exceptions. In this Typed application configuration 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 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 engineer needs to explain deployment history and correlation IDs. In this Typed application configuration 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: 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 team is splitting a monolithic template into ownership domains. In this Typed application configuration 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: 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 release must support both cloud-hosted and private agents. In this Typed application configuration 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 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: An environment has drift that must be reconciled before deployment. In this Typed application configuration 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 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 parameter-file change could expose secrets in source control. In this Typed application configuration 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: 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 policy assignment blocks an otherwise valid deployment. In this Typed application configuration 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: 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 stack deletion plan might detach or remove production assets. In this Typed application configuration 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 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 product team is moving a manually configured web workload into version control. In this Typed application configuration 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 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 regulated payment service needs a separate production boundary. In this Typed application configuration 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: 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 platform team is publishing shared modules for dozens of teams. In this Typed application configuration 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: 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: An acquisition introduces existing subscriptions and naming rules. In this Typed application configuration 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 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 deployment must preserve an existing database and its data. In this Typed application configuration 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 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 currently uses a long-lived service-principal secret. In this Typed application configuration 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: 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 regional rollout needs consistent network and policy baselines. In this Typed application configuration 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: 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 deployment preview shows unexpected resource replacement. In this Typed application configuration 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 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 per-environment values without copying templates. In this Typed application configuration 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 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 resource provider API version changes its required property shape. In this Typed application configuration 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: 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 auditor needs reproducible evidence for each infrastructure change. In this Typed application configuration 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: 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 shared module has breaking changes planned for a new release. In this Typed application configuration 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 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 policy denies public endpoints but a legacy system depends on one. In this Typed application configuration 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 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 team needs separate owners for subscription and workload resources. In this Typed application configuration 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: 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 failed pipeline leaves a partially completed deployment. In this Typed application configuration 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: 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 development environment must be safely torn down every sprint. In this Typed application configuration 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 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 production change must pass review before any write operation. In this Typed application configuration 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 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 nested module unexpectedly deploys to the wrong scope. In this Typed application configuration 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: 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 template contains a secret copied from a local parameter file. In this Typed application configuration 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: 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 release introduces a naming collision in one environment. In this Typed application configuration 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 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 central team wants to enforce diagnostic settings consistently. In this Typed application configuration 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 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 stack may delete resources removed from its template. In this Typed application configuration 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: 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 module registry artifact is missing or inaccessible in CI. In this Typed application configuration 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: 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 resource is changed manually after a successful deployment. In this Typed application configuration 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 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 what-if report contains many no-change and unsupported lines. In this Typed application configuration 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 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 needs to deploy to multiple subscriptions with OIDC. In this Typed application configuration 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: 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 migrating a large ARM JSON template incrementally. In this Typed application configuration 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: 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 compliance team needs a time-bounded exception process. In this Typed application configuration 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 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 is close to subscription quota limits. In this Typed application configuration 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 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 shared platform module has no clear deprecation policy. In this Typed application configuration 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: 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 stack uses deny settings that could block child resource changes. In this Typed application configuration 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: 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 resource is supported only in selected Azure regions. In this Typed application configuration 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 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 team must restore a prior configuration after a faulty change. In this Typed application configuration 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 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 deployment uses a Key Vault reference from another subscription. In this Typed application configuration 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: 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 output accidentally exposes a sensitive endpoint token. In this Typed application configuration 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: 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 new service needs diagnostic, monitoring, and backup coverage. In this Typed application configuration 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 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 is standardizing tags and resource naming in Bicep. In this Typed application configuration 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 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 Typed application configuration 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: A new service needs diagnostic, monitoring, and backup coverage. Review the production rollout for Typed application configuration 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 Typed application configuration 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: Typed application configuration 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: Typed application configuration 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: Typed application configuration 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: Typed application configuration 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: Typed application configuration 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 Typed application configuration 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 →

Refactor and review

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

Core model

Write maintainable Bicep with typed parameters, decorators, variables, outputs, user-defined types and functions, while applying a deliberate configuration policy.

This module uses Refactor and review 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 Refactor and review? 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 Refactor and review 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 release must support both cloud-hosted and private agents. In this Refactor and review 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: An environment has drift that must be reconciled before deployment. In this Refactor and review 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 parameter-file change could expose secrets in source control. In this Refactor and review 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 policy assignment blocks an otherwise valid deployment. In this Refactor and review 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 stack deletion plan might detach or remove production assets. In this Refactor and review 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: A product team is moving a manually configured web workload into version control. In this Refactor and review 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 regulated payment service needs a separate production boundary. In this Refactor and review 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 platform team is publishing shared modules for dozens of teams. In this Refactor and review 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: An acquisition introduces existing subscriptions and naming rules. In this Refactor and review 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 deployment must preserve an existing database and its data. In this Refactor and review 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 pipeline currently uses a long-lived service-principal secret. In this Refactor and review 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 regional rollout needs consistent network and policy baselines. In this Refactor and review 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 deployment preview shows unexpected resource replacement. In this Refactor and review 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 team needs per-environment values without copying templates. In this Refactor and review 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 resource provider API version changes its required property shape. In this Refactor and review 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: An auditor needs reproducible evidence for each infrastructure change. In this Refactor and review 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 shared module has breaking changes planned for a new release. In this Refactor and review 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 policy denies public endpoints but a legacy system depends on one. In this Refactor and review 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 team needs separate owners for subscription and workload resources. In this Refactor and review 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 failed pipeline leaves a partially completed deployment. In this Refactor and review 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 development environment must be safely torn down every sprint. In this Refactor and review 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 production change must pass review before any write operation. In this Refactor and review 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 nested module unexpectedly deploys to the wrong scope. In this Refactor and review 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 template contains a secret copied from a local parameter file. In this Refactor and review 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 release introduces a naming collision in one environment. In this Refactor and review 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 central team wants to enforce diagnostic settings consistently. In this Refactor and review 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 deployment stack may delete resources removed from its template. In this Refactor and review 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 module registry artifact is missing or inaccessible in CI. In this Refactor and review 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 resource is changed manually after a successful deployment. In this Refactor and review 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 what-if report contains many no-change and unsupported lines. In this Refactor and review 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 pipeline needs to deploy to multiple subscriptions with OIDC. In this Refactor and review 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 migrating a large ARM JSON template incrementally. In this Refactor and review 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 compliance team needs a time-bounded exception process. In this Refactor and review 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 deployment is close to subscription quota limits. In this Refactor and review 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 shared platform module has no clear deprecation policy. In this Refactor and review 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: A stack uses deny settings that could block child resource changes. In this Refactor and review 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 resource is supported only in selected Azure regions. In this Refactor and review 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 team must restore a prior configuration after a faulty change. In this Refactor and review 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 deployment uses a Key Vault reference from another subscription. In this Refactor and review 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 module output accidentally exposes a sensitive endpoint token. In this Refactor and review 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 new service needs diagnostic, monitoring, and backup coverage. In this Refactor and review 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 team is standardizing tags and resource naming in Bicep. In this Refactor and review 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 pipeline must separate validation credentials from deployment identity. In this Refactor and review 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 management group deployment needs carefully scoped assignments. In this Refactor and review 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 module change passes build but fails at provider validation. In this Refactor and review 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: An environment promotion must compare source and target configuration. In this Refactor and review 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 team wants to test snapshots without querying live Azure. In this Refactor and review 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 Refactor and review. (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 management group deployment needs carefully scoped assignments. Review the production rollout for Refactor and review. 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 Refactor and review 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: Refactor and review — 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: Refactor and review — 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: Refactor and review — 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: Refactor and review — 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: Refactor and review — 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 Refactor and review 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. Parameters and allowed values: build, lint, review scope, validate, inspect what-if, deploy only after approval, verify and retain evidence.
  2. Variables, expressions and interpolation: build, lint, review scope, validate, inspect what-if, deploy only after approval, verify and retain evidence.
  3. Outputs and secret-safe contracts: build, lint, review scope, validate, inspect what-if, deploy only after approval, verify and retain evidence.
  4. Primitive, object and union types: build, lint, review scope, validate, inspect what-if, deploy only after approval, verify and retain evidence.
  5. Decorators and validation: build, lint, review scope, validate, inspect what-if, deploy only after approval, verify and retain evidence.
  6. Bicep configuration and linter rules: build, lint, review scope, validate, inspect what-if, deploy only after approval, verify and retain evidence.
  7. Typed application configuration lab: build, lint, review scope, validate, inspect what-if, deploy only after approval, verify and retain evidence.
  8. Refactor and review: 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.