---
title: "Round-trip Container Apps templates through az rest, not az containerapp show"
url: "https://www.dariuszparys.com/notes/container-apps-template-round-trip-through-az-rest"
author: "Dariusz Parys"
published: 2026-11-09T00:00:00.000Z
description: "A template read with az containerapp show cannot be sent back with an ARM PATCH, because the CLI extension adds fields the API rejects. Read it with az rest at the same api-version instead."
---

# Round-trip Container Apps templates through az rest, not az containerapp show

## Context

To change a Container App's scale rules in place (for example the start and end metadata of a KEDA `cron` rule), the obvious route is: read the app with `az containerapp show`, edit `properties.template`, and send it back with `az rest --method patch`.

## Insight

That PATCH fails with:

```
Bad Request: Unknown properties imageType in ContainerAppContainer are not supported
```

The `containerapp` CLI extension adds fields such as `imageType` to its output that the ARM API version does not accept. So read the resource with `az rest` against the **same api-version** you PATCH with, change only what you need, and send the rest back unchanged.

A template PATCH also creates a new revision. Each app shows `provisioningState: InProgress` for a minute or two, so wait for `Succeeded` before reading the result. Until then the old values can still show up.

## Snippet

```bash
url="https://management.azure.com/subscriptions/$SUB/resourceGroups/$RG/providers/Microsoft.App/containerApps/$APP?api-version=2025-01-01"
az rest --method get --url "$url" --query properties.template > template.json
# edit template.json (e.g. scale.rules[].custom.metadata.start/end)
az rest --method patch --url "$url" \
  --body "{\"properties\":{\"template\":$(cat template.json)}}"

# wait until every app has settled
az containerapp list -g "$RG" --query "[].{n:name,state:properties.provisioningState}" -o table
```

`az containerapp update --min-replicas/--max-replicas` is fine for simple scale values. For custom scale-rule metadata, use the GET → PATCH round trip above.
