Lab: Bicep deploy, preview, and rollback
Outcome
Edit a small Bicep file, build and lint it, preview its changes, deploy it with a named resource-group deployment, diagnose an invalid change, and revert the desired state.
Do
-
Create a disposable resource group and a
main.bicepthat deploys a tagged storage account with parameters for name, location, SKU, and adeployNameoutput. Runaz bicep build --file main.bicepandaz bicep lint --file main.bicep. -
Run
az deployment group what-if --resource-group <rg> --template-file main.bicep --parameters storageName=<unique-name>; inspect the predicted changes. Deploy only after the output matches the intended state:az deployment group create --name training-initial --resource-group <rg> \ --template-file main.bicep --parameters storageName=<unique-name> -
Change only the tag value, build/lint/what-if again, and deploy it under a new name. Inspect deployment history, outputs, and the resource tag.
Verify
Keep build/lint output, both what-if results, deployment names/outputs, and portal/CLI resource state. You should now understand: Bicep is source; ARM evaluates the deployment; what-if predicts but does not apply changes; deployment history records each attempt.
Break and fix
- Introduce an invalid property or parameter type. Capture build/lint or ARM validation output, correct the source, and re-run the full preview.
- Make an unintended SKU/tag change. Stop at what-if, revert the source, and prove the preview is empty or intended. If already deployed, restore the earlier desired configuration with a new deployment; do not edit generated JSON as the canonical source.
Scenario practice
- Configure: Select parameter boundaries and deployment scope for a reusable resource-group template.
- Diagnose: A deployment fails after what-if. Inspect Bicep diagnostics, deployment operations, RBAC, provider registration, and actual resource constraints.
- Distinguish: Contrast build/lint, what-if, validation, deployment history, and rollback by desired-state redeployment.
Clean up
Delete the training resource group and local generated JSON artifact if it was created only for the lab.
Sources and re-audit
- Deploy Bicep with Azure CLI, checked 2026-08-22.
- Bicep what-if, checked 2026-08-22.
Re-audit when Bicep validation, what-if, or deployment commands change.