From Bicep to a running deployment
The infrastructure model end to end — network, compute, secrets — then the runbook that turns it into a live environment and the migration job that seeds the schema.
Step 7 — Phase 2 Bicep deployment: managed identity + Container Apps (issue 006)
Re-run the deployment with backendImage now populated. This triggers the
mi, cae, postgrest, backendApp, and migrateJob modules.
az deployment group create \
--resource-group rg-mike-dev \
--template-file infra/main.bicep \
--parameters infra/main.parameters.dev.json \
--parameters pgAdminPassword="$PG_PASS" \
--parameters backendImage="acrmikedev.azurecr.io/backend:${GIT_SHA}"
What gets added:
| Resource | Name | Detail |
|---|---|---|
| User-Assigned Managed Identity | mi-mike-dev |
AcrPull on acrmikedev, KV Secrets User on kv-mike-dev, Storage Blob Data Contributor on stmikedev |
| Container Apps Environment | cae-mike-dev |
VNet-integrated on subnet-cae (no log destination) |
| Container App | postgrest |
Internal ingress only — reachable as http://postgrest within the CAE |
| Container App | backend |
External HTTPS ingress |
| Container Apps Job | db-migrate |
Manual trigger, runs node-pg-migrate up |
Why User-Assigned MI? Container Apps pull from ACR and read KV secrets at start time. With system-assigned identities the roles can't be assigned until the app exists, but the app can't start without the roles — a deadlock. UAMI is created first, roles assigned, then the Container Apps deploy and the identity is already authorised.