Azure / Azure/container-apps-deploy-action

Error: argument `targetPort` only works if the container app does not exist yet

Open
#105 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
94
Forks
51
Avg merge
4d 18h
Merged PRs (30d)
1

Description

When you set the `targetPort` argument in the GitHub Action for deploying Container Apps on Azure, the initial deployment succeeds, but subsequent updates fail.

Here's an example configuration that triggers the issue:

```yaml
- name: Deploy Container App
uses: azure/container-apps-deploy-action@v2
with:
containerAppName: test-app
resourceGroup: [...resourceGroup]
imageToDeploy: [...imageUrl]
targetPort: 8080
```

**Identified Issue:**

The root of the problem seems to be the Azure CLI command `az containerapp update`, which lacks support for the `target-port` argument. Consequently, this Action defaults to using the `up` command for both initial deployments and updates. However, if the app is already running, attempting an update with the `up` command and a specified `target-port` results in a `Forbidden` error:

```text
/usr/bin/az containerapp up [...] --target-port 8080
ERROR: Operation returned an invalid status 'Forbidden'
```

As the ingress setup is only needed during creation, this Action should skip the `targetPort` and only update the container or (if specified) delete and re-create the container if the `targetPort` changed

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the GitHub Action deployment flow and reproduce the example using `targetPort` with `az containerapp up`. Compare the initial deployment path with updates using `az containerapp update`, and verify that an existing app updates without the Forbidden error while initial creation still configures the target port.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, github-actions
Domain
cli, cloud, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.