Hardcoded API Version "2025-01-01" Causes Failures with Future System Dates
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 3.5k
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 60
Description
### 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
Contributor guide
Assessment
This issue has not been assessed yet.