Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Prepare applications for Azure deployment by generating infrastructure code, Dockerfiles, and config files.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/services/container-apps/networking.md
1# Container Apps Networking23VNet integration, ingress configuration, custom domains, and TLS for Container Apps.45## Ingress Modes67| Mode | Visibility | Use Case |8|------|-----------|----------|9| External | Internet-accessible | Public APIs, web apps |10| Internal | Not internet-accessible; reachable within the environment and VNet (if VNet-injected) | Microservices, back-end APIs |11| Disabled | No HTTP ingress | Background workers, queue processors |1213### Bicep โ External Ingress1415```bicep16configuration: {17ingress: {18external: true19targetPort: 808020transport: 'auto'21allowInsecure: false22}23}24```2526### Bicep โ Internal Ingress2728```bicep29configuration: {30ingress: {31external: false32targetPort: 808033}34}35```3637> ๐ก **Tip:** Internal apps get a `*.internal.<env-default-domain>` FQDN. This is accessible from within the Container Apps environment and, when the environment is VNet-injected, also from the VNet.3839## VNet Integration4041Container Apps run inside an environment that can be injected into a VNet subnet.4243### Subnet Requirements4445| Requirement | Workload Profiles (default) | Consumption-only (legacy) |46|------------|---------------------------|--------------------------|47| Minimum subnet size | `/27` (32 addresses) | `/23` (512 addresses) |48| Delegation | `Microsoft.App/environments` | `Microsoft.App/environments` |49| Dedicated | Subnet must be exclusive to the Container Apps environment | Same |5051### Bicep โ VNet-Integrated Environment5253```bicep54resource subnet 'Microsoft.Network/virtualNetworks/subnets@2023-11-01' = {55parent: vnet56name: 'container-apps-subnet'57properties: {58addressPrefix: '10.0.16.0/27'59delegations: [60{61name: 'Microsoft.App.environments'62properties: { serviceName: 'Microsoft.App/environments' }63}64]65}66}6768resource env 'Microsoft.App/managedEnvironments@2024-03-01' = {69name: envName70location: location71properties: {72vnetConfiguration: {73infrastructureSubnetId: subnet.id74internal: false // true for internal-only environment75}76}77}78```7980> โ ๏ธ **Warning:** VNet configuration is set at environment creation and cannot be changed afterward. Plan your network topology before creating the environment.8182## Custom Domains8384### Steps85861. Add a CNAME or A record pointing to the Container App's FQDN or static IP872. Bind the custom domain to the Container App883. Configure a managed or custom TLS certificate8990```bash91# Register custom domain (hostname only โ no cert provisioned yet)92az containerapp hostname add -n $APP -g $RG --hostname app.contoso.com9394# Bind managed certificate (provisions and attaches TLS cert)95az containerapp hostname bind -n $APP -g $RG \96--hostname app.contoso.com \97--environment $ENV_NAME \98--validation-method CNAME99```100101### DNS Configuration102103| Record Type | Name | Value |104|------------|------|-------|105| CNAME | `app.contoso.com` | `<app-name>.<region>.azurecontainerapps.io` |106| TXT (verification) | `asuid.app.contoso.com` | `<verification-id>` |107| A (apex domain) | `contoso.com` | Environment static IP |108109> ๐ก **Tip:** Use `az containerapp show -n $APP -g $RG --query properties.configuration.ingress.fqdn` to get the target FQDN for DNS records.110111## TLS Configuration112113### Managed Certificates114115Azure automatically provisions and renews TLS certificates for custom domains โ no manual cert management required.116117> โ ๏ธ **Prerequisites:** Managed certificates require the app to be externally reachable with valid **public** DNS (CNAME or HTTP validation). They do **not** work for internal environments or apps behind private DNS. For private/internal scenarios, bring your own certificate via `az containerapp ssl upload`.118119## IP Restrictions120121> โ ๏ธ **Warning:** IP restriction rules are evaluated in **array order** (first match wins). The `priority` field does not exist in the Container Apps API โ order your rules carefully in the array.122123Allow-only rules implicitly deny all traffic not matching any rule. Deny-only rules implicitly allow all other traffic.124125```bicep126configuration: {127ingress: {128external: true129targetPort: 8080130ipSecurityRestrictions: [131{132name: 'allow-office'133action: 'Allow'134ipAddressRange: '203.0.113.0/24'135description: 'Office network'136}137{138name: 'allow-vpn'139action: 'Allow'140ipAddressRange: '198.51.100.0/24'141description: 'VPN gateway'142}143]144}145}146```147148## Network Topology Summary149150| Topology | Environment `internal` | Ingress `external` | Access |151|----------|----------------------|-------------------|--------|152| Public app | `false` | `true` | Internet + VNet |153| Internal microservice | `false` | `false` | Same environment; VNet if environment is VNet-injected |154| Fully private (VNet-wide) | `true` | `true` | VNet only (no public IP); accessible from anywhere in the VNet |155| Fully private (env-only) | `true` | `false` | VNet only (no public IP); accessible only within the Container Apps environment |156157> โ ๏ธ **Warning:** An internal environment has no public IP. You need VPN, ExpressRoute, or a jump box to reach apps in an internal environment.158