Skip to content

[Container Apps] Fix Azure/azure-cli-extensions#10018: Fix invalid API version by using valid preview clients consistently#10019

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-hardcoded-api-version
Draft

[Container Apps] Fix Azure/azure-cli-extensions#10018: Fix invalid API version by using valid preview clients consistently#10019
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-hardcoded-api-version

Conversation

Copilot AI commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

The extension inconsistently fell back to the core module's ManagedEnvironmentClient and ContainerAppClient in several code paths. These core clients use CURRENT_API_VERSION = "2025-01-01" which is unavailable in some regions/subscriptions, causing InvalidApiVersionParameter errors. The extension already defines ManagedEnvironmentPreviewClient and ContainerAppPreviewClient with a valid API version (2025-10-02-preview) — they just weren't used uniformly.

Changes

  • _clients.py: Added CURRENT_API_VERSION = "2025-07-01" (latest stable Microsoft.App version) as an extension-level constant.
  • containerapp_decorator.py, containerapp_job_decorator.py: get_environment_client() fallback path (no env / no env-type specified) now returns ManagedEnvironmentPreviewClient instead of the core ManagedEnvironmentClient. Removed unused imports.
  • containerapp_sessionpool_decorator.py: Switched import from azure.cli.command_modules.containerapp._clients.ManagedEnvironmentClient to the extension's ManagedEnvironmentPreviewClient.
  • _dev_service_utils.py: DevServiceUtils.create_service and delete_service now use ManagedEnvironmentPreviewClient / ContainerAppPreviewClient.
  • _utils.py: get_min_replicas_from_revision and get_random_replica now use ContainerAppPreviewClient instead of the core ContainerAppClient.

Related command

az containerapp, az containerapp job, az containerapp sessionpool, az containerapp add-on

General Guidelines

  • Have you run azdev style <YOUR_EXT> locally? (pip install azdev required)
  • Have you run python scripts/ci/test_index.py -q locally? (azdev required; see .azure-pipelines/templates/azdev_setup.yml for the install command until azdev==0.2.11b1 is on PyPI)
  • My extension version conforms to the Extension version schema

For new extensions:

About Extension Publish

There is a pipeline to automatically build, upload and publish extension wheels.
Once your pull request is merged into main branch, a new pull request will be created to update src/index.json automatically.
You only need to update the version information in file setup.py and historical information in file HISTORY.rst in your PR but do not modify src/index.json.

@azure-client-tools-bot-prd

azure-client-tools-bot-prd Bot commented Jun 22, 2026

Copy link
Copy Markdown
️✔️Azure CLI Extensions Breaking Change Test
️✔️Non Breaking Changes

@azure-client-tools-bot-prd

Copy link
Copy Markdown

Hi @copilot,
Please write the description of changes which can be perceived by customers into HISTORY.rst.
If you want to release a new extension version, please update the version in setup.py as well.

Copilot AI changed the title [WIP] Fix hardcoded API version 2025-01-01 in containerapp module [Container Apps] Fix Azure/azure-cli-extensions#10018: Fix invalid API version by using valid preview clients consistently Jun 22, 2026
Copilot AI requested a review from a0x1ab June 22, 2026 22:37
@yonzhan

yonzhan commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

Container Apps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Auto-Assign Auto assign by bot ContainerApp

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants