Azure / Azure/azure-cli-extensions

[containerapp] Hardcoded API Version "2025-01-01" Causes Failures with Future System Dates

Open
#10,018 2 comments 1 reaction 2 assignees Claimed by @a0x1ab View on GitHub
Auto-Assign ContainerApp Service Attention
Dominant language
Python
Stars
454
Forks
1.7k
Avg merge
2d 19h
Merged PRs (30d)
64

Description

Source: https://github.com/Azure/azure-cli/issues/32181 (by @don-hicks)
Affected extension: `containerapp` (`src/containerapp/`)

---

<<>>
# Issue #32181 (by @don-hicks)
## Title
Hardcoded API Version "2025-01-01" Causes Failures with Future System Dates

## Body
### Describe the bug

Azure CLI containerapp module fails with "InvalidApiVersionParameter" when system date is set to 2025. The core module has a hardcoded API version "2025-01-01" that is not valid. This affects all containerapp commands when using the core module (not extension) on systems with dates in 2025.

### Related command

'''
az containerapp list
az containerapp logs show
az containerapp show
'''
### Errors
'''
ERROR: (InvalidApiVersionParameter) The api-version '2025-01-01' is invalid. The supported versions are '2025-04-01,2025-03-01,2024-10-01-preview,2024-11-01,2024-08-01,2024-07-01,2024-06-01-preview,2024-03-01,2023-07-01,2023-07-01-preview,2023-03-01-preview,2022-12-01,2022-11-01-preview,2022-09-01,2022-06-01,2022-05-01,2022-03-01-preview,2022-01-01,2021-04-01,2021-01-01,2020-10-01,2020-09-01,2020-08-01,2020-07-01,2020-06-01,2020-05-01,2020-01-01,2019-11-01,2019-10-01,2019-09-01,2019-08-01,2019-07-01,2019-06-01,2019-05-10,2019-05-01,2019-03-01,2018-11-01,2018-09-01,2018-08-01,2018-07-01,2018-06-01,2018-05-01,2018-02-01,2018-01-01,2017-12-01,2017-08-01,2017-06-01,2017-05-10,2017-05-01,2017-03-01,2016-09-01,2016-07-01,2016-06-01,2016-02-01,2015-11-01,2015-01-01,2014-04-01-preview,2014-04-01,2014-01-01,2013-03-01,2014-02-26,2014-04'.
'''

### Issue script & Debug output
'''
# Reproduction script
#!/bin/bash
# Show system date (2025-09-26)
date

# Ensure core module is used (not extension)
az extension remove -n containerapp 2>/dev/null

# Try to list container apps
az containerapp list --resource-group "myresourcegroup" --debug 2>&1 | grep -A5 -B5 "api-version"
'''
# Debug output shows:
'''
Request URL: https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myresourcegroup/providers/Microsoft.App/containerApps?api-version=2025-01-01
Response status: 400
Response headers: {...}
Response content: {"error":{"code":"InvalidApiVersionParameter","message":"The api-version '2025-01-01' is invalid..."}}
'''
### Expected behavior

Commands should execute successfully using a valid API version like "2024-03-01" instead of the hardcoded "2025-01-01".

### Environment Summary

'''
azure-cli 2.77.0

core 2.77.0
telemetry 1.1.0

Dependencies:
msal 1.31.0
azure-mgmt-resource 23.2.0

Python location '/opt/az/bin/python3'
Extensions directory '/home/glucose/.azure/cliextensions'

Python (Linux) 3.13.0 (main, Oct 8 2024, 01:04:00) [GCC 11.4.0]

Legal docs and information: aka.ms/AzureCliLegal
'''

### Additional context

The root cause is in `/opt/az/lib/python3.13/site-packages/azure/cli/command_modules/containerapp/_clients.py` line 19:
''' python
CURRENT_API_VERSION = "2025-01-01"
'''

This hardcoded value is not a valid API version. The issue only affects the core module - when the containerapp extension is installed, it masks this bug.

**Workaround:**
''' bash
sudo sed -i 's/CURRENT_API_VERSION = "2025-01-01"/CURRENT_API_VERSION = "2024-03-01"/' \
/opt/az/lib/python3.13/site-packages/azure/cli/command_modules/containerapp/_clients.py
'''

**System Information:**
- OS: Linux 6.6.87.2-microsoft-standard-WSL2
- System Date: 2025-09-26
- Python: 3.13

## Comments
### Comment by @azure-client-tools-bot-prd[bot]
Hi @don-hicks,

2.64.0 is not the latest Azure CLI(2.77.0).

If you haven't already attempted to do so, please upgrade to the latest Azure CLI version by following https://learn.microsoft.com/en-us/cli/azure/update-azure-cli.

### Comment by @yonzhan

Thank you for opening this issue, we will look into it.

### Comment by @don-hicks
Yes, sorry, I put the wrong version in the initial report, it is the latest 2.77 where the bug has surfaced

### Comment by @Greedygre
Hi @don-hicks
Did you still occur this issue?
May I ask what is the Location that you got this issue?

### Comment by @Greedygre
Hi @don-hicks

After investigation, we found issue cause by the command run with `--resource-group/-g` with **empty value**, repro:
'''
az containerapp list --resource-group "" --debug --query "[].name"
'''

Can you specify a valid resource group name or without `--resource-group/-g` in the command?

Edit:

Here is the request we found for your request
'''
https://management.azure.com:443/subscriptions/{sub-id}/resourceGroups/providers/Microsoft.App/containerApps?api-version=2025-01-01
'''
There is no `myresourcegroup` shown in the URL, Can you check why the resource group value didn't set correctly?

Thanks

<<>>

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.