Container Apps Environment should be deployed in a virtual network

High Azure General managedenvironments-container-apps-environment-dep

Applies to

  • Microsoft.App/managedEnvironments

What CGPulse checks

A resource passes this rule when hasVnet must equal true. Anything else is reported as a finding with the evaluated property value attached as evidence.

How to fix it

Integrate with a Virtual Network to route traffic privately. In Azure Portal: Container Apps Environment > Networking > configure VNet (set at creation). See: https://learn.microsoft.com/en-us/azure/container-apps/vnet-custom

CLI

az containerapp env show --ids "{id}" --query "properties.vnetConfiguration"

Bicep

resource env 'Microsoft.App/managedEnvironments@2024-03-01' = {{
  name: '{name}'
  location: location
  properties: {{
    vnetConfiguration: {{
      infrastructureSubnetId: subnetId
      internal: true
    }}
    appLogsConfiguration: {{
      destination: 'log-analytics'
      logAnalyticsConfiguration: {{
        customerId: '<workspace-customer-id>'
        sharedKey: '<workspace-shared-key>'
      }}
    }}
  }}
}}

Terraform

resource "azurerm_container_app_environment" "{name}" {
  name                           = "{name}"
  resource_group_name            = "{rg}"
  location                       = var.location
  log_analytics_workspace_id     = var.workspace_id
  infrastructure_subnet_id       = var.subnet_id
  internal_load_balancer_enabled = true
}

Compliance frameworks

Is your environment compliant with this rule?

CGPulse checks it — and 621 others — against your Azure and AWS accounts with read-only access.

Run a free scan

Related Azure rules

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please reload the page.