From 0d664a6d77b188db8b65b81f118c2440fdba828c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 22 Jun 2026 22:23:40 +0000 Subject: [PATCH 1/2] Initial plan From 77e5ccf23716589398969ecb49aea76d3540d811 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 22 Jun 2026 22:37:17 +0000 Subject: [PATCH 2/2] [Container Apps] Fix Azure/azure-cli-extensions#10018: Fix invalid API version by using valid preview clients consistently --- src/containerapp/HISTORY.rst | 1 + src/containerapp/azext_containerapp/_clients.py | 1 + src/containerapp/azext_containerapp/_dev_service_utils.py | 8 ++++---- src/containerapp/azext_containerapp/_utils.py | 2 +- .../azext_containerapp/containerapp_decorator.py | 4 ++-- .../azext_containerapp/containerapp_job_decorator.py | 4 ++-- .../containerapp_sessionpool_decorator.py | 4 ++-- 7 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/containerapp/HISTORY.rst b/src/containerapp/HISTORY.rst index d8a16d4737d..2d9d83b3ae1 100644 --- a/src/containerapp/HISTORY.rst +++ b/src/containerapp/HISTORY.rst @@ -4,6 +4,7 @@ Release History =============== upcoming ++++++ +* Fix invalid API version used in managed environment client: use valid preview API version consistently 1.3.0b4 ++++++ diff --git a/src/containerapp/azext_containerapp/_clients.py b/src/containerapp/azext_containerapp/_clients.py index 27b890e5f5f..c567c0c0feb 100644 --- a/src/containerapp/azext_containerapp/_clients.py +++ b/src/containerapp/azext_containerapp/_clients.py @@ -29,6 +29,7 @@ logger = get_logger(__name__) +CURRENT_API_VERSION = "2025-07-01" PREVIEW_API_VERSION = "2025-10-02-preview" POLLING_TIMEOUT = 1500 # how many seconds before exiting POLLING_SECONDS = 2 # how many seconds between requests diff --git a/src/containerapp/azext_containerapp/_dev_service_utils.py b/src/containerapp/azext_containerapp/_dev_service_utils.py index bc0dcd428bc..b714f415497 100644 --- a/src/containerapp/azext_containerapp/_dev_service_utils.py +++ b/src/containerapp/azext_containerapp/_dev_service_utils.py @@ -6,7 +6,7 @@ from azure.cli.core.azclierror import CLIError, ResourceNotFoundError from ._client_factory import handle_raw_exception -from ._clients import ManagedEnvironmentClient, ContainerAppClient +from ._clients import ManagedEnvironmentPreviewClient, ContainerAppPreviewClient from ._constants import ( CONTAINER_APPS_RP ) @@ -25,7 +25,7 @@ def create_service(cmd, service_name, environment_name, resource_group_name, no_ env_info = None try: - env_info = ManagedEnvironmentClient.show(cmd=cmd, resource_group_name=resource_group_name, + env_info = ManagedEnvironmentPreviewClient.show(cmd=cmd, resource_group_name=resource_group_name, name=environment_name) except Exception: # pylint: disable=broad-except pass @@ -46,7 +46,7 @@ def delete_service(cmd, service_name, resource_group_name, no_wait, service_type containerapp_def = None try: - containerapp_def = ContainerAppClient.show(cmd=cmd, resource_group_name=resource_group_name, + containerapp_def = ContainerAppPreviewClient.show(cmd=cmd, resource_group_name=resource_group_name, name=service_name) except Exception: # pylint: disable=broad-except pass @@ -59,7 +59,7 @@ def delete_service(cmd, service_name, resource_group_name, no_wait, service_type raise ResourceNotFoundError("The service '{}' of type {} does not exist".format(service_name, service_type)) try: - return ContainerAppClient.delete(cmd=cmd, name=service_name, resource_group_name=resource_group_name, + return ContainerAppPreviewClient.delete(cmd=cmd, name=service_name, resource_group_name=resource_group_name, no_wait=no_wait) except CLIError as e: handle_raw_exception(e) diff --git a/src/containerapp/azext_containerapp/_utils.py b/src/containerapp/azext_containerapp/_utils.py index b7015e9d4ac..08485d22d15 100644 --- a/src/containerapp/azext_containerapp/_utils.py +++ b/src/containerapp/azext_containerapp/_utils.py @@ -23,7 +23,7 @@ from azure.cli.command_modules.acr.custom import acr_show from azure.cli.command_modules.containerapp._utils import safe_get, _ensure_location_allowed, \ _generate_log_analytics_if_not_provided -from azure.cli.command_modules.containerapp._clients import ContainerAppClient +from ._clients import ContainerAppPreviewClient as ContainerAppClient from azure.cli.command_modules.containerapp._client_factory import handle_raw_exception from azure.cli.core._profile import Profile from azure.cli.core.azclierror import (ValidationError, ResourceNotFoundError, CLIError, InvalidArgumentValueError) diff --git a/src/containerapp/azext_containerapp/containerapp_decorator.py b/src/containerapp/azext_containerapp/containerapp_decorator.py index 9dfa3f4ceb5..372fb9ac0a3 100644 --- a/src/containerapp/azext_containerapp/containerapp_decorator.py +++ b/src/containerapp/azext_containerapp/containerapp_decorator.py @@ -50,7 +50,7 @@ from msrest.exceptions import DeserializationError -from ._clients import ManagedEnvironmentClient, ConnectedEnvironmentClient, ManagedEnvironmentPreviewClient +from ._clients import ConnectedEnvironmentClient, ManagedEnvironmentPreviewClient from ._client_factory import handle_raw_exception, handle_non_404_status_code_exception, get_linker_client from ._models import ( RegistryCredentials as RegistryCredentialsModel, @@ -1255,7 +1255,7 @@ def get_environment_client(self): environment_type = self.get_argument_environment_type() if not env and not environment_type: - return ManagedEnvironmentClient + return ManagedEnvironmentPreviewClient parsed_env = parse_resource_id(env) diff --git a/src/containerapp/azext_containerapp/containerapp_job_decorator.py b/src/containerapp/azext_containerapp/containerapp_job_decorator.py index db80dadfdb8..b37b85f91cf 100644 --- a/src/containerapp/azext_containerapp/containerapp_job_decorator.py +++ b/src/containerapp/azext_containerapp/containerapp_job_decorator.py @@ -38,7 +38,7 @@ from ._client_factory import handle_raw_exception, handle_non_404_status_code_exception from ._constants import CONNECTED_ENVIRONMENT_RESOURCE_TYPE, \ MANAGED_ENVIRONMENT_TYPE, CONNECTED_ENVIRONMENT_TYPE, ACR_IMAGE_SUFFIX -from ._clients import ManagedEnvironmentClient, ConnectedEnvironmentClient, ManagedEnvironmentPreviewClient +from ._clients import ConnectedEnvironmentClient, ManagedEnvironmentPreviewClient from ._decorator_utils import (create_deserializer, process_loaded_yaml, load_yaml_file) @@ -768,7 +768,7 @@ def get_environment_client(self): environment_type = self.get_argument_environment_type() if not env and not environment_type: - return ManagedEnvironmentClient + return ManagedEnvironmentPreviewClient parsed_env = parse_resource_id(env) diff --git a/src/containerapp/azext_containerapp/containerapp_sessionpool_decorator.py b/src/containerapp/azext_containerapp/containerapp_sessionpool_decorator.py index 76f5e5eb172..762f2724775 100644 --- a/src/containerapp/azext_containerapp/containerapp_sessionpool_decorator.py +++ b/src/containerapp/azext_containerapp/containerapp_sessionpool_decorator.py @@ -26,7 +26,7 @@ _ensure_location_allowed, CONTAINER_APPS_RP, validate_container_app_name, safe_set, safe_get, _ensure_identity_resource_id) -from azure.cli.command_modules.containerapp._clients import ManagedEnvironmentClient +from ._clients import ManagedEnvironmentPreviewClient from azure.cli.command_modules.containerapp._client_factory import handle_non_404_status_code_exception from azure.cli.command_modules.containerapp._decorator_utils import load_yaml_file from azure.cli.command_modules.containerapp._utils import is_registry_msi_system @@ -162,7 +162,7 @@ def get_argument_probe_yaml(self): # pylint: disable=no-self-use def get_environment_client(self): - return ManagedEnvironmentClient + return ManagedEnvironmentPreviewClient def set_up_probes(self): probes_def = load_yaml_file(self.get_argument_probe_yaml())