fix: Dev to main PR - #1132
Conversation
fix: avm+waf deployment
There was a problem hiding this comment.
Pull request overview
This pull request updates the deployment and post-provisioning workflow to better support Azure Container Apps initially provisioned with the default MCR “bootstrap” image (azuredocs/containerapps-helloworld), ensuring ingress/registry configuration behaves correctly until the real images are built and swapped in.
Changes:
- Add bootstrap-image detection in infra templates and conditionally set Container App ingress port to
80and omit registry config when bootstrap images are used. - Update post-provision scripts to update Container App image and ingress target port (and registries) in a single helper function.
- Introduce additional infra adjustments (App Service logging configuration, new env vars, and regenerated Bicep JSON outputs/hashes).
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| infra/scripts/post-provision/Build-And-Push-Images.ps1 | Adds helper to update Container App image + ingress port + registries during post-provision. |
| infra/scripts/post-provision/build_and_push_images.sh | Adds helper (jq-based) to update Container App image + ingress port + registries during post-provision. |
| infra/main.json | Regenerated router template JSON; includes bootstrap detection + tag changes. |
| infra/bicep/main.json | Regenerated vanilla Bicep ARM JSON; includes bootstrap detection, conditional ingress/registries, and new backend env vars. |
| infra/bicep/main.bicep | Adds bootstrap-image detection vars and applies conditional ingress port + conditional registries. |
| infra/avm/main.json | Regenerated AVM ARM JSON; includes bootstrap detection, conditional ingress/registries, and App Service logging/networking parameters. |
| infra/avm/main.bicep | Adds bootstrap-image detection vars and applies conditional ingress port + conditional registries. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
fix: improve error handling in image build script
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.
Suppressed comments (1)
infra/scripts/post-provision/build_and_push_images.sh:61
- In the jq transform,
(.identity.userAssignedIdentities | keys[0])will throw a jq runtime error whenuserAssignedIdentitiesis null/missing (e.g., system-assigned identity only). That prevents the intended actionable error ("Container App does not have a user-assigned identity...") from being emitted.
Use a null-safe default object before calling keys so the script fails with your explicit message.
| (.identity.userAssignedIdentities | keys[0]) as $identity_resource_id
| if $identity_resource_id == null then error("Container App does not have a user-assigned identity for ACR image pulls") else . end
Purpose
This pull request introduces logic to better handle deployments using the default Microsoft Container Registry (MCR) "bootstrap" images for backend and MCP container apps. The main improvements include automatically adjusting the ingress port and omitting registry configuration when the bootstrap image is detected, as well as several infrastructure enhancements and minor fixes.
Container App Deployment Logic:
azuredocs/containerapps-helloworld). This detection is exposed via new variables (backendUsesBootstrapImage,mcpUsesBootstrapImage). [1] [2] [3] [4]80if using the bootstrap image, otherwise it defaults to the previous values (8000for backend,9000for MCP). [1] [2] [3] [4] [5] [6]registriesset tonull). Otherwise, the registry configuration remains as before. [1] [2] [3] [4] [5] [6]Infrastructure and Configuration Enhancements:
logsConfigresource for App Service with verbose logging, error messages, and HTTP logs enabled. This replaces the previous inlinelogsconfiguration. [1] [2]vnetRouteAllEnabledandimagePullTrafficparameters to support private networking scenarios. [1] [2]Other Minor Updates:
virtualMachineAvailabilityZonevalue from1to-1.These changes improve deployment flexibility, especially for quick starts and demos using the default bootstrap image, and enhance logging and networking capabilities for production scenarios.
Does this introduce a breaking change?
How to Test
What to Check
Verify that the following are valid
Other Information