AZCLI Validation
Validation steps for Azure CLI deployments.
Prerequisites
./infra/main.bicepexists- Docker available (if containerized)
Validation Steps
- [ ] 1. Azure CLI Installation
- [ ] 2. Authentication
- [ ] 3. Bicep Compilation
- [ ] 4. Template Validation
- [ ] 5. What-If Preview
- [ ] 6. Docker Build (if containerized)
- [ ] 7. Azure Policy Validation
Validation Details
1. Azure CLI Installation
Verify Azure CLI is installed:
az versionIf not installed:
mcp_azure_mcp_extension_cli_install(cli-type: "az")2. Authentication
az account showIf not logged in:
az loginSet subscription:
az account set --subscription <subscription-id>3. Bicep Compilation
az bicep build --file ./infra/main.bicep4. 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.json5. What-If Preview
# Subscription scope
az deployment sub what-if \
--location <location> \
--template-file ./infra/main.bicep \
--parameters ./infra/main.parameters.json
# Resource group scope
az deployment group what-if \
--resource-group <rg-name> \
--template-file ./infra/main.bicep \
--parameters ./infra/main.parameters.json6. Docker Build (if containerized)
Before building, validate the Docker build context:
- Read the
Dockerfilein./src/<service> - If the Dockerfile contains
npm ci, verifypackage-lock.jsonexists in the same directory - If
package-lock.jsonis missing, generate it:
cd ./src/<service>
npm install --package-lock-onlyThen build:
docker build -t <image>:test ./src/<service>7. Azure Policy Validation
See Policy Validation Guide for instructions on retrieving and validating Azure policies for your subscription.
References
Next
All checks pass → azure-deploy