skip to content
Alvin Lucillo

Adding containerapps env creates new revision

/ 3 min read

For this TIL, this Azure AI 200 exercise was referenced: https://microsoftlearning.github.io/mslearn-azure-ai/instructions/azure-container-apps/02-aca-manage-containers.html

In the Python script from the link above, it already creates the resource group, container registry, container app, image, and container environment.

In the commands below, the MODEL_NAME variable is first shown as absent, then added to the container app environment.

  aca-manage az containerapp show -n $CONTAINER_APP_NAME -g $RESOURCE_GROUP \
    --query "properties.template.containers[0].env" -o table
The behavior of this command has been altered by the following extension: containerapp
Name                Value    SecretRef
------------------  -------  ------------------
EMBEDDINGS_API_KEY           embeddings-api-key

New env var is set.

az containerapp update -n $CONTAINER_APP_NAME -g $RESOURCE_GROUP \
    --set-env-vars MODEL_NAME=$MODEL_NAME
The behavior of this command has been altered by the following extension: containerapp
{
  "id": "/subscriptions/[REDACTED]/resourceGroups/rg-aca-manage/providers/Microsoft.App/containerapps/ai-api",
  "identity": {
    "principalId": "[REDACTED]",
    "tenantId": "[REDACTED]",
    "type": "SystemAssigned"
  },
  "location": "Central India",
  "name": "ai-api",
  "properties": {
    "configuration": {
      "activeRevisionsMode": "Single",
      "dapr": null,
      "identitySettings": [],
      "ingress": {
        "additionalPortMappings": null,
        "allowInsecure": false,
        "clientCertificateMode": null,
        "corsPolicy": null,
        "customDomains": null,
        "exposedPort": 0,
        "external": true,
        "fqdn": "[REDACTED]",
        "ipSecurityRestrictions": null,
        "stickySessions": null,
        "targetPort": 8000,
        "targetPortHttpScheme": null,
        "traffic": [
          {
            "latestRevision": true,
            "weight": 100
          }
        ],
        "transport": "Auto"
      },
      "maxInactiveRevisions": null,
      "registries": [
        {
          "identity": "system",
          "passwordSecretRef": "",
          "server": "[REDACTED]",
          "username": ""
        }
      ],
      "revisionTransitionThreshold": null,
      "runtime": null,
      "secrets": [
        {
          "name": "embeddings-api-key"
        }
      ],
      "service": null,
      "targetLabel": ""
    },
    "customDomainVerificationId": "[REDACTED]",
    "delegatedIdentities": [],
    "environmentId": "/subscriptions/[REDACTED]/resourceGroups/rg-aca-manage/providers/Microsoft.App/managedEnvironments/[REDACTED]",
    "eventStreamEndpoint": "[REDACTED]",
    "latestReadyRevisionName": "ai-api--0000003",
    "latestRevisionFqdn": "[REDACTED]",
    "latestRevisionName": "ai-api--0000004",
    "managedEnvironmentId": "/subscriptions/[REDACTED]/resourceGroups/rg-aca-manage/providers/Microsoft.App/managedEnvironments/[REDACTED]",
    "outboundIpAddresses": [
      "[REDACTED]"
    ],
    "patchingMode": "Automatic",
    "provisioningState": "Succeeded",
    "runningStatus": "Running",
    "template": {
      "containers": [
        {
          "env": [
            {
              "name": "EMBEDDINGS_API_KEY",
              "secretRef": "embeddings-api-key",
              "value": ""
            },
            {
              "name": "MODEL_NAME"
            }
          ],
          "image": "[REDACTED]/ai-api:v1",
          "imageType": "ContainerImage",
          "name": "ai-api",
          "resources": {
            "cpu": 0.5,
            "ephemeralStorage": "2Gi",
            "memory": "1Gi"
          }
        }
      ],
      "customMetricsSettings": null,
      "initContainers": null,
      "revisionSuffix": "",
      "scale": {
        "cooldownPeriod": 300,
        "maxReplicas": 10,
        "minReplicas": null,
        "pollingInterval": 30,
        "rules": null
      },
      "serviceBinds": null,
      "terminationGracePeriodSeconds": null,
      "volumes": null
    },
    "workloadProfileName": "Consumption"
  },
  "resourceGroup": "rg-aca-manage",
  "systemData": {
    "createdAt": "2026-08-22T09:30:34.7320862",
    "createdBy": "[REDACTED]",
    "createdByType": "User",
    "lastModifiedAt": "2026-08-22T09:57:30.4872784",
    "lastModifiedBy": "[REDACTED]",
    "lastModifiedByType": "User"
  },
  "type": "Microsoft.App/containerApps"
}

The new env is visible in the command output.

  aca-manage az containerapp show -n $CONTAINER_APP_NAME -g $RESOURCE_GROUP \
    --query "properties.template.containers[0].env" -o table
The behavior of this command has been altered by the following extension: containerapp
Name                Value         SecretRef
------------------  ------------  ------------------
EMBEDDINGS_API_KEY                embeddings-api-key
MODEL_NAME          gpt-5.4-mini

Listing the revisions, there’s a new version.

  aca-manage az containerapp revision list -n $CONTAINER_APP_NAME -g $RESOURCE_GROUP -o table
CreatedTime                Active    Replicas    TrafficWeight    HealthState    ProvisioningState    Name
-------------------------  --------  ----------  ---------------  -------------  -------------------  ---------------
2026-08-22T09:35:47+00:00  True      0           0                Healthy        Provisioned          ai-api--0000003
2026-08-22T09:57:37+00:00  True      1           100              Healthy        Provisioned          ai-api--0000004