Container App resources must use standard naming#
Operational Excellence · Container App · Rule · 2025_12 · Awareness
Container App 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, the Cloud Adoption Framework (CAF) recommends using the ca- prefix.
Requirements for Container App resource names:
- Between 2 and 32 characters long.
- Lowercase letters, numbers, and hyphens.
- Start with letter and end with alphanumeric.
- Can not contain consecutive hyphens.
Recommendation#
Consider creating Container App 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 Container Apps that pass this rule:
- Set the
nameproperty to a string that matches the naming requirements. - Optionally, consider constraining name parameters with
minLengthandmaxLengthattributes.
For example:
@minLength(2)
@maxLength(32)
@description('The name of the container app.')
param appName string
resource containerApp 'Microsoft.App/containerApps@2025-01-01' = {
name: appName
location: location
identity: {
type: 'SystemAssigned'
}
properties: {
environmentId: containerEnv.id
template: {
revisionSuffix: revision
containers: containers
scale: {
minReplicas: 2
}
}
configuration: {
ingress: {
allowInsecure: false
external: false
stickySessions: {
affinity: 'none'
}
}
}
}
}
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:
To use the latest version:
Configure with Azure template#
To deploy Container Apps that pass this rule:
- Set the
nameproperty to a string that matches the naming requirements. - Optionally, consider constraining name parameters with
minLengthandmaxLengthattributes.
For example:
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"envName": {
"type": "string",
"metadata": {
"description": "The name of the app environment."
}
},
"appName": {
"type": "string",
"minLength": 2,
"maxLength": 32,
"metadata": {
"description": "The name of the container app."
}
},
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "The location resources will be deployed."
}
},
"workspaceId": {
"type": "string",
"metadata": {
"description": "The name of a Log Analytics workspace"
}
},
"subnetId": {
"type": "string",
"metadata": {
"description": "The resource ID of a VNET subnet."
}
},
"revision": {
"type": "string",
"metadata": {
"description": "The revision of the container app."
}
}
},
"variables": {
"containers": [
{
"name": "simple-hello-world-container",
"image": "mcr.microsoft.com/azuredocs/containerapps-helloworld:latest",
"resources": {
"cpu": "[json('0.25')]",
"memory": ".5Gi"
}
}
]
},
"resources": [
{
"type": "Microsoft.App/containerApps",
"apiVersion": "2025-01-01",
"name": "[parameters('appName')]",
"location": "[parameters('location')]",
"identity": {
"type": "SystemAssigned"
},
"properties": {
"environmentId": "[resourceId('Microsoft.App/managedEnvironments', parameters('envName'))]",
"template": {
"revisionSuffix": "[parameters('revision')]",
"containers": "[variables('containers')]",
"scale": {
"minReplicas": 2
}
},
"configuration": {
"ingress": {
"allowInsecure": false,
"external": false,
"stickySessions": {
"affinity": "none"
}
}
}
}
}
]
}
Notes#
This rule does not check if Container App resource names are unique.
Rule configuration#
AZURE_CONTAINER_APP_NAME_FORMAT
To configure this rule set the AZURE_CONTAINER_APP_NAME_FORMAT configuration value to a regular expression
that matches the required format.
For example:
Links#
- OE:04 Tools and processes
- Operational Excellence: Level 2
- Recommended abbreviations for Azure resource types
- Naming rules and restrictions for Azure resources
- Define your naming convention
- Parameters in Bicep
- Bicep functions
- Azure deployment reference