Bicep Validation
Validation steps for standalone Bicep deployments.
Prerequisites
./infra/main.bicepexists./infra/main.parameters.jsonexists- Azure CLI authenticated
Validation Steps
- [ ] 1. Bicep Compilation
- [ ] 2. Template Validation
- [ ] 3. What-If Preview
- [ ] 4. Authentication
- [ ] 5. Linting (optional)
- [ ] 6. Azure Policy Validation
Validation Details
1. Bicep Compilation
az bicep build --file ./infra/main.bicepPass: No output (compiles cleanly) Fail: Shows line numbers and errors
2. Template Validation
# Subscription scope
az deployment sub validate \
--location <location> \
--template-file ./infra/main.bicep \
--parameters ./infra/main.parameters.json
# Resource group scope
az deployment group validate \
--resource-group <rg-name> \
--template-file ./infra/main.bicep \
--parameters ./infra/main.parameters.json3. What-If Preview
az deployment sub what-if \
--location <location> \
--template-file ./infra/main.bicep \
--parameters ./infra/main.parameters.jsonExpected output:
Resource and property changes are indicated with these symbols:
+ Create
~ Modify
- Delete4. Authentication
az account show5. Linting (optional)
Use Bicep linter rules:
az bicep lint --file ./infra/main.bicep6. Azure Policy Validation
See Policy Validation Guide for instructions on retrieving and validating Azure policies for your subscription.
Checklist
| Check | Command | Pass |
|---|---|---|
| Bicep compiles | az bicep build | ☐ |
| Template valid | az deployment validate | ☐ |
| What-if passes | az deployment what-if | ☐ |
| Auth valid | az account show | ☐ |
| Policies validated | MCP Policy tool | ☐ |
References
Next
All checks pass → azure-deploy