Skip to content

Container App Environment resources must use standard naming#

Operational Excellence · Container App Environment · Rule · 2025_12 · Awareness

Container App Environment resources without a standard naming convention may be difficult to identify and manage.

Description#

An effective naming convention allows operators to quickly identify resources, related systems, and their purpose. Identifying resources easily is important to improve operational efficiency, reduce the time to respond to incidents, and minimize the risk of human error.

Some of the benefits of using standardized tagging and naming conventions are:

  • They provide consistency and clarity for resource identification and discovery across the Azure Portal, CLIs, and APIs.
  • They enable filtering and grouping of resources for billing, monitoring, security, and compliance purposes.
  • They support resource lifecycle management, such as provisioning, decommissioning, backup, and recovery.

For example, if you come upon a security incident, it's critical to quickly identify affected systems, the functions that those systems support, and the potential business impact.

For Container App Environment, the Cloud Adoption Framework (CAF) recommends using the cae- prefix.

Requirements for Container App Environment resource names:

  • Between 2 and 60 characters long.
  • Lowercase letters, numbers, and hyphens.

Recommendation#

Consider creating Container App Environment resources with a standard name. Additionally consider using Azure Policy to only permit creation using a standard naming convention.

Examples#

Configure with Bicep#

To deploy resources that pass this rule:

  • Set the name property to a string that matches the naming requirements.
  • Optionally, consider constraining name parameters with minLength and maxLength attributes.

For example:

Azure Bicep snippet
@minLength(2)
@maxLength(60)
@description('The name of the resource.')
param name string

@description('The location resources will be deployed.')
param location string = resourceGroup().location

resource containerEnv 'Microsoft.App/managedEnvironments@2025-01-01' = {
  name: name
  location: location
  properties: {
    appLogsConfiguration: {
      destination: 'log-analytics'
      logAnalyticsConfiguration: {
        customerId: workspace.properties.customerId
        sharedKey: workspace.listKeys().primarySharedKey
      }
    }
    zoneRedundant: true
    workloadProfiles: [
      {
        name: 'Consumption'
        workloadProfileType: 'Consumption'
      }
    ]
    vnetConfiguration: {
      infrastructureSubnetId: subnetId
      internal: true
    }
  }
}

Configure with Azure Verified Modules

A pre-validated module supported by Microsoft is available from the Azure Bicep public registry. To reference the module, please use the following syntax:

br/public:avm/res/app/managed-environment:<version>

To use the latest version:

br/public:avm/res/app/managed-environment:0.9.1

Configure with Azure template#

To deploy resources that pass this rule:

  • Set the name property to a string that matches the naming requirements.
  • Optionally, consider constraining name parameters with minLength and maxLength attributes.

For example:

Azure Template snippet
{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "name": {
      "type": "string",
      "minLength": 2,
      "maxLength": 60,
      "metadata": {
        "description": "The name of the resource."
      }
    },
    "location": {
      "type": "string",
      "defaultValue": "[resourceGroup().location]",
      "metadata": {
        "description": "The location resources will be deployed."
      }
    }
  },
  "resources": [
    {
      "type": "Microsoft.App/managedEnvironments",
      "apiVersion": "2025-01-01",
      "name": "[parameters('name')]",
      "location": "[parameters('location')]",
      "properties": {
        "appLogsConfiguration": {
          "destination": "log-analytics",
          "logAnalyticsConfiguration": {
            "customerId": "[reference(resourceId('Microsoft.OperationalInsights/workspaces', split(parameters('workspaceId'), '/')[8]), '2022-10-01').customerId]",
            "sharedKey": "[listKeys(resourceId('Microsoft.OperationalInsights/workspaces', split(parameters('workspaceId'), '/')[8]), '2022-10-01').primarySharedKey]"
          }
        },
        "zoneRedundant": true,
        "workloadProfiles": [
          {
            "name": "Consumption",
            "workloadProfileType": "Consumption"
          }
        ],
        "vnetConfiguration": {
          "infrastructureSubnetId": "[parameters('subnetId')]",
          "internal": true
        }
      }
    }
  ]
}

Notes#

This rule does not check if Container App Environment resource names are unique.

Rule configuration#

AZURE_CONTAINER_APP_ENVIRONMENT_NAME_FORMAT

To configure this rule set the AZURE_CONTAINER_APP_ENVIRONMENT_NAME_FORMAT configuration value to a regular expression that matches the required format.

For example:

configuration:
  AZURE_CONTAINER_APP_ENVIRONMENT_NAME_FORMAT: '^cae-'

Comments