Azure / azure-cli-extensions

Public Repository for Extensions of Azure CLI.
https://docs.microsoft.com/en-us/cli/azure
MIT License
384 stars 1.25k forks source link

Container Apps are always created in the wrong region (az containerapp compose create) #7542

Open vienleidl opened 6 months ago

vienleidl commented 6 months ago

Describe the bug

Even though, the location is stated in the az containerapp compose create command with southeastasia, but the Container Apps Environment and its Container Apps are always created in the WEST US 2 region as unexpectedly.

Related command

az containerapp compose create -g ResourceGroupName --environment ContainerAppEnvName --location southeastasia

OR

az containerapp compose create -g ResourceGroupName --environment ContainerAppEnvName -l southeastasia

OR

az containerapp compose create -g ResourceGroupName --environment ContainerAppEnvName --location "Southeast Asia"

Errors

The Container Apps Environment and its Container Apps are always created in the wrong region on Azure portal.

Issue script & Debug output

cli.knack.cli: Command arguments: ['containerapp', 'compose', 'create', '-g', 'ResourceGroupName', '--environment', 'ContainerAppEnvName', '--location', 'Southeast Asia', '--compose-file-path', './docker-compose.yml', '--registry-server', 'acr.azurecr.io', '--registry-username', 'acr-username', '--registry-password', 'acr-pass', '--debug'] az_command_data_logger: extension name: containerapp az_command_data_logger: extension version: 0.3.50 cli.azure.cli.core.commands: The behavior of this command has been altered by the following extension: containerapp cli.azure.cli.core.sdk.policies: Request method: 'GET' cli.azure.cli.core.sdk.policies: Request headers: cli.azure.cli.core.sdk.policies: 'Accept': 'application/json' cli.azure.cli.core.sdk.policies: 'CommandName': 'containerapp compose create' cli.azure.cli.core.sdk.policies: 'ParameterSetName': '-g --environment --location --compose-file-path --registry-server --registry-username --registry-password --debug' cli.azure.cli.core.sdk.policies: 'User-Agent': 'AZURECLI/2.59.0 (MSI) azsdk-python-core/1.28.0 Python/3.11.8 (Windows-10-10.0.22631-SP0)' cli.azure.cli.core.sdk.policies: Request body: cli.azure.cli.core.sdk.policies: This request has no body cli.azure.cli.core.util: {"error":{"code":"ResourceNotFound","message":"The Resource 'Microsoft.App/managedEnvironments/ContainerAppEnvName' under resource group 'ResourceGroupName' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix"}} cli.azext_containerapp.custom: Creating the Container Apps managed environment ContainerAppEnvName under ResourceGroupName in southeastasia.

Expected behavior

The Container Apps Environment and its Container Apps should be created in the Southeast Asia region as stated in the az containerapp compose create command.

Environment Summary

azure-cli 2.59.0 core 2.59.0 telemetry 1.1.0

Extensions: aks-preview 3.0.0b5 azure-devops 1.0.0 containerapp 0.3.50

Dependencies: msal 1.27.0 azure-mgmt-resource 23.1.0b2

Additional context

The same issue happens also in Azure DevOps release pipelines.

yonzhan commented 6 months ago

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

Greedygre commented 6 months ago

Hi @vienleidl

Thanks for reporting this issue. I checked and there is a bug when creating a new environment during az containerapp compose it doesn't use the input location. I will fix it.

For workaround: Create a environment in southeastasia first: az containerapp env create -g ResourceGroupName --environment ContainerAppEnvName --location southeastasia Then execute the compose command.

Thanks.