Azure / Azure/azure-dev

azd deploy, custom domains and the following error is observed if apiVersion is not supplied

Open
#6,092 2 comments 1 reaction 0 assignees View on GitHub
area/provisioning customer-reported question
Dominant language
Go
Stars
569
Forks
364
Avg merge
2d 19h
Merged PRs (30d)
136

Description

- [x] Make sure you've installed the latest version using [instructions](https://github.com/Azure/azure-dev?tab=readme-ov-file#installupgrade-azure-developer-cli)

**Output from `azd version`**
1.20.3

**Describe the bug**

When deploying a container app using `azd deploy` with a custom domain the following error is presented:

```
The following error is observed if apiVersion is not supplied

ERROR: failed deploying service 'app': updating container app service: getting container app: getting container app: unmarshalling type *armappcontainers.ContainerApp: unmarshalling type *armappcontainers.ContainerApp: struct field Properties: unmarshalling type *armappcontainers.ContainerAppProperties: struct field Configuration: unmarshalling type *armappcontainers.Configuration: struct field Ingress: unmarshalling type *armappcontainers.Ingress: struct field CustomDomains: unmarshalling type *armappcontainers.CustomDomain: struct field BindingType: json: cannot unmarshal number into Go value of type armappcontainers.BindingType
Suggestion: set 'apiVersion' on your service in azure.yaml to match the API version in your IaC:

services:
your-service:
apiVersion: 2025-02-02-preview
```

**To Reproduce**
Use the approach detailed here: https://johnnyreilly.com/using-azd-for-faster-incremental-azure-container-app-deployments-in-azure-devops#azure-devops-pipeline-modifications

However use this ARM template: https://learn.microsoft.com/en-us/azure/templates/microsoft.app/2025-07-01/containerapps?pivots=deployment-language-bicep

And use the approach mentioned by @vinisoto here: https://github.com/microsoft/azure-container-apps/issues/796#issuecomment-2704976869

**Expected behavior**
That it just works. In reality you need to add an `apiVersion` field to the `azure.yaml` (as the error message advises):

```yaml
# yaml-language-server: $schema=https://raw.githubusercontent.com/Azure/azure-dev/main/schemas/v1.0/azure.yaml.json

name: my-container-app
metadata:
template: azd-init@1.9.4
services:
app:
image: myregistry.azurecr.io/${CONTAINER_IMAGE_NAME}:${APP_VERSION_TAG}
host: containerapp
resourceName: ${CONTAINER_APP_NAME}
apiVersion: 2025-07-01
```

Ideally, supplying this should not be necessary - it's not obvious why it is necessary now TBH

**Environment**
N/A - running in an Azure DevOps pipeline

**Additional context**
If I can, I'll likely blog this issue since it's a bit surprising.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.