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.