This directory contains the Bicep infrastructure as code for the Billing Auto application.
The deployment creates the following resources:
- Azure Container Registry (ACR): For storing container images
- PostgreSQL Flexible Server: Database server with one database
- Key Vault: For storing secrets and configuration
- Storage Account: Blob storage
- Container App Environment: For hosting containerized applications
- Log Analytics Workspace: For logging and monitoring
- Managed Identity: User-assigned identity for resource access
- Existing Resource Group:
B2C-LYZR-BILLINGAUTO-RGRP - Existing VNet:
WTW-ITCOLT-DEVwith address space10.58.52.0/26 - Azure CLI installed and authenticated
- Appropriate permissions to deploy resources
# Deploy to the existing resource group
az deployment group create \
--resource-group B2C-LYZR-BILLINGAUTO-RGRP \
--template-file main.bicep \
--parameters parameters.jsonBefore deploying, you can preview the changes:
az deployment group what-if \
--resource-group B2C-LYZR-BILLINGAUTO-RGRP \
--template-file main.bicep \
--parameters parameters.jsonThe deployment creates two subnets in the existing VNet:
-
containerAppSubnet (
10.58.52.0/28):- Delegated to Container Apps
- Service endpoints for Key Vault and Storage
-
dbSubnet (
10.58.52.16/28):- For database private endpoints
- Private endpoint network policies disabled
All configuration is in parameters.json. Key parameters:
- vnetName: Name of the existing VNet
- vnetResourceGroup: Resource group containing the VNet
- acrName: Globally unique ACR name
- pgServerName: Globally unique PostgreSQL server name
- storageAccountName: Globally unique storage account name (3-24 lowercase chars)
- databaseName: Name of the PostgreSQL database to create
- PostgreSQL uses Entra ID authentication only (password auth disabled)
- Key Vault uses RBAC authorization
- Storage account disables public blob access
- Private endpoints for PostgreSQL
- Network ACLs restrict access to specific subnets
- Managed identity for secure resource access
The deployment outputs key resource identifiers:
- Managed Identity ID and Principal ID
- ACR login server
- PostgreSQL server FQDN and database name
- Key Vault name
- Storage account blob endpoint
- Container App Environment ID
Private endpoint DNS records are automatically created by WTW automation within 5 minutes of deployment. Do not manually configure Private DNS Zones.
Reference: WTW Private Endpoint Automation
After deployment:
-
Grant the managed identity necessary RBAC roles on ACR:
az role assignment create \ --assignee <managed-identity-principal-id> \ --role AcrPull \ --scope <acr-id>
-
Store application secrets in Key Vault
-
Configure container apps to use the environment
billing-auto/
├── main.bicep # Main orchestration file
├── parameters.json # Configuration parameters
├── README.md # This file
└── modules/
├── acr.bicep # Azure Container Registry
├── postgresql.bicep # PostgreSQL Flexible Server
├── keyvault.bicep # Key Vault
├── storage.bicep # Storage Account
└── container-app-env.bicep # Container App Environment
To customize the deployment:
- Edit
parameters.jsonto change resource configurations - Modify individual module files in
modules/for specific resource changes - Update
main.bicepto add or remove resources