Subchapter 28.13
references/recipes/bicep/README.mdMarkdown3 KBView on GitHub
./infra/main.bicep exists./infra/main.parameters.json existsvalidate-deployment scriptThe core validation checks are a fixed, deterministic sequence — identical to the AZCLI
recipe. Run the shared validate-deployment helper instead of executing and parsing each
command by hand. It confirms the Azure CLI is installed and authenticated, compiles the Bicep
template (az bicep build), validates it against the target scope (az deployment ... validate), and runs a what-if preview — printing a compact PASS/FAIL summary plus a what-if
change count (Create/Modify/Delete).
../scripts/validate-deployment.sh../scripts/validate-deployment.ps1Subscription scope:
../scripts/validate-deployment.sh --scope sub --location <location>../scripts/validate-deployment.ps1 -Scope sub -Location <location>Resource group scope:
../scripts/validate-deployment.sh --scope group --resource-group <rg-name>../scripts/validate-deployment.ps1 -Scope group -ResourceGroup <rg-name>Defaults: --template ./infra/main.bicep, --parameters ./infra/main.parameters.json
(skipped if absent). Pass --subscription <id> to target a specific subscription.
Interpreting results:
OVERALL: PASS — all checks passed; record the summary in Section 7 (Validation Proof).FAIL — the script prints the failing command’s error. If Authenticated fails,
run az login. Otherwise see Error handling.Use Bicep linter rules:
az bicep lint --file ./infra/main.bicepSee Policy Validation Guide for instructions on retrieving and validating Azure policies for your subscription.
| Check | Command | Pass |
|---|---|---|
| Core validation (CLI, auth, build, validate, what-if) | validate-deployment script | ☐ |
| Policies validated | MCP Policy tool | ☐ |
All checks pass → azure-deploy