Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"az containerapp show" does not return exit code 3 when the Container App does not exist #28318

Open
masashiyonekawa opened this issue Feb 7, 2024 · 3 comments
Labels
Auto-Assign Auto assign by bot bug This issue requires a change to an existing behavior in the product in order to be resolved. ContainerApp customer-reported Issues that are reported by GitHub users external to the Azure organization. Service Attention This issue is responsible by Azure service team.

Comments

@masashiyonekawa
Copy link

Describe the bug

The az containerapp show command errors with exit code 1 when no Container App exists.

Related command

az containerapp show

Errors

$ az containerapp show --name CONTAINER_APP_NAME --resource-group RG --subscription SUBSCRIPTION
The behavior of this command has been altered by the following extension: containerapp
(ResourceNotFound) The Resource 'Microsoft.App/containerApps/CONTAINER_APP_NAME' under resource group 'RG' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix

$ echo $?
1

Issue script & Debug output

$ az containerapp show --name CONTAINER_APP_NAME --resource-group RG --subscription SUBSCRIPTION --debug
cli.knack.cli: Command arguments: ['containerapp', 'show', '--name', 'CONTAINER_APP_NAME', '--resource-group', 'RG', '--subscription', 'b
43fdb54-b148-4d60-a89f-a68fa05b3fb1', '--debug']
cli.knack.cli: __init__ debug log:
Enable color in terminal.
cli.knack.cli: Event: Cli.PreExecute []
cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x01382898>, <function OutputProducer.on_global_a
rguments at 0x016A6988>, <function CLIQuery.on_global_arguments at 0x016CC7A8>]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Modules found from index for 'containerapp': ['azext_containerapp', 'azure.cli.command_modules.containerapp', 'azure.cli.command_modules.serviceconnector']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name                  Load Time    Groups  Commands
cli.azure.cli.core: containerapp              0.294        36       115
cli.azure.cli.core: serviceconnector          0.110        20       299
cli.azure.cli.core: Total (2)                 0.403        56       414
cli.azure.cli.core: These extensions are not installed and will be skipped: ['azext_ai_examples', 'azext_next']
cli.azure.cli.core: Loading extensions:
cli.azure.cli.core: Name                  Load Time    Groups  Commands  Directory
cli.azure.cli.core: containerapp              0.014        30        81  DIRECTORY
cli.azure.cli.core: Total (1)                 0.014        30        81  
cli.azure.cli.core: Loaded 74 groups, 471 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command  : containerapp show
cli.azure.cli.core: Command table: containerapp show
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x03753578>]
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to 'DIRECTORY\.azure\commands\2024-02-07.19-03-22.containerapp_show.24772.log'.
az_command_data_logger: command args: containerapp show --name {} --resource-group {} --subscription {} --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument.<locals>.add_subscription_parameter at 0x037671B8>]
cli.knack.commands: Configured default 'RG' for arg resource_group_name
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument.<locals>.add_ids_arguments at 0x0378F898>, <function register_cache_arguments.<locals>.add_cache_arguments at 0x0378F8E8>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x016A69D8>, <function CLIQuery.handle_query_parameter at 0x016CC7F8>, <function register_ids_argument.<locals>.parse_ids_arguments at 0x0378F7A8>]
az_command_data_logger: extension name: containerapp
az_command_data_logger: extension version: 0.3.46
cli.azure.cli.core.commands: The behavior of this command has been altered by the following extension: containerapp
cli.azure.cli.core.commands.client_factory: Getting management service client client_type=ResourceManagementClient
cli.azure.cli.core.auth.persistence: build_persistence: location='DIRECTORY\\.azure\\msal_token_cache.bin', encrypt=True
cli.azure.cli.core.auth.binary_cache: load: DIRECTORY\.azure\msal_http_cache.bin
urllib3.util.retry: Converted retries value: 1 -> Retry(total=1, connect=None, read=None, redirect=None, status=None)
msal.authority: openid_config = {'token_endpoint': 'https://login.microsoftonline.com/ec449cfa-3a33-4fde-ba33-ce11d541198d/oauth2/v2.0/token', 'token_endpoint_auth_methods_supported': ['client_secret_post', 'private_key_jwt', 'client_secret_basic'], 'jwks_uri': 'https://login.microsoftonline.com/ec449cfa-3a33-4fde-ba33-ce11d541198d/discovery/v2.0/keys', 'response_modes_supported': ['query', 'fragment', 'form_post'], 'subject_types_supported': ['pairwise'], 'id_token_signing_alg_values_supported': ['RS256'], 'response_types_supported': ['code', 'id_token', 'code id_token', 'id_token token'], 'scopes_supported': ['openid', 'profile', 'email', 'offline_access'], 'issuer': 'https://login.microsoftonline.com/ec449cfa-3a33-4fde-ba33-ce11d541198d/v2.0', 'request_uri_parameter_supported': False, 'userinfo_endpoint': 'https://graph.microsoft.com/oidc/userinfo', 'authorization_endpoint': 'https://login.microsoftonline.com/ec449cfa-3a33-4fde-ba33-ce11d541198d/oauth2/v2.0/authorize', 'device_authorization_endpoint': 'https://login.microsoftonline.com/ec449cfa-3a33-4fde-ba33-ce11d541198d/oauth2/v2.0/devicecode', 'http_logout_supported': True, 'frontchannel_logout_supported': True, 'end_session_endpoint': 'https://login.microsoftonline.com/ec449cfa-3a33-4fde-ba33-ce11d541198d/oauth2/v2.0/logout', 'claims_supported': ['sub', 'iss', 'cloud_instance_name', 'cloud_instance_host_name', 'cloud_graph_host_name', 'msgraph_host', 'aud', 'exp', 'iat', 'auth_time', 'acr', 'nonce', 'preferred_username', 'name', 'tid', 'ver', 'at_hash', 'c_hash', 'email'], 'kerberos_endpoint': 'https://login.microsoftonline.com/ec449cfa-3a33-4fde-ba33-ce11d541198d/kerberos', 'tenant_region_scope': 'AS', 'cloud_instance_name': 'microsoftonline.com', 'cloud_graph_host_name': 'graph.windows.net', 'msgraph_host': 'graph.microsoft.com', 'rbac_url': 'https://pas.windows.net'}
msal.application: Broker enabled? False
cli.azure.cli.core.auth.credential_adaptor: CredentialAdaptor.get_token: scopes=('https://management.core.windows.net//.default',), kwargs={}
cli.azure.cli.core.auth.msal_authentication: UserCredential.get_token: scopes=('https://management.core.windows.net//.default',), claims=None, kwargs={}
0m
msal.application: Cache hit an AT
msal.telemetry: Generate or reuse correlation_id: 32685137-b208-4de3-b279-6098c9be31f6
cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com/subscriptions/SUBSCRIPTION/providers/Microsoft.App?api-version=2022-09-01'
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:     'x-ms-client-request-id': '206507b4-c5a0-11ee-bee4-845cf32c9768'
cli.azure.cli.core.sdk.policies:     'CommandName': 'containerapp show'
cli.azure.cli.core.sdk.policies:     'ParameterSetName': '--name --resource-group --subscription --debug'
cli.azure.cli.core.sdk.policies:     'User-Agent': 'AZURECLI/2.57.0 (MSI) azsdk-python-azure-mgmt-resource/23.1.0b2 Python/3.11.7 (Windows-10-10.0.19045-SP0)'
cli.azure.cli.core.sdk.policies:     'Authorization': '*****'
cli.azure.cli.core.sdk.policies: Request body:
cli.azure.cli.core.sdk.policies: This request has no body
urllib3.connectionpool: Starting new HTTPS connection (1): management.azure.com:443
urllib3.connectionpool: https://management.azure.com:443 "GET /subscriptions/SUBSCRIPTION/providers/Microsoft.App?api-version=2022-09-01 HTTP/1.1" 200 19416
cli.azure.cli.core.sdk.policies: Response status: 200
cli.azure.cli.core.sdk.policies: Response headers:
cli.azure.cli.core.sdk.policies:     'Cache-Control': 'no-cache'
cli.azure.cli.core.sdk.policies:     'Pragma': 'no-cache'
cli.azure.cli.core.sdk.policies:     'Content-Length': '19416'
cli.azure.cli.core.sdk.policies:     'Content-Type': 'application/json; charset=utf-8'
cli.azure.cli.core.sdk.policies:     'Expires': '-1'
cli.azure.cli.core.sdk.policies:     'x-ms-ratelimit-remaining-subscription-reads': '11998'
cli.azure.cli.core.sdk.policies:     'x-ms-request-id': '68817a76-7ff6-436e-9257-46f6e8813010'
cli.azure.cli.core.sdk.policies:     'x-ms-correlation-request-id': '68817a76-7ff6-436e-9257-46f6e8813010'
cli.azure.cli.core.sdk.policies:     'x-ms-routing-request-id': 'JAPANEAST:20240207T100323Z:68817a76-7ff6-436e-9257-46f6e8813010'
cli.azure.cli.core.sdk.policies:     'Strict-Transport-Security': 'max-age=31536000; includeSubDomains'
cli.azure.cli.core.sdk.policies:     'X-Content-Type-Options': 'nosniff'
cli.azure.cli.core.sdk.policies:     'X-Cache': 'CONFIG_NOCACHE'
cli.azure.cli.core.sdk.policies:     'X-MSEdge-Ref': 'Ref A: A99EB6C475A3464E9DCA2F13936ADAD0 Ref B: TYO201100116049 Ref C: 2024-02-07T10:03:23Z'     
cli.azure.cli.core.sdk.policies:     'Date': 'Wed, 07 Feb 2024 10:03:22 GMT'
cli.azure.cli.core.sdk.policies: Response content:
cli.azure.cli.core.sdk.policies: {"id":"/subscriptions/SUBSCRIPTION/providers/Microsoft.App","namespace":"Microsoft.App","authoriz
ations":[{"applicationId":"7e3bc4fd-85a3-4192-b177-5b8bfc87f42c","roleDefinitionId":"39a74f72-b40f-4bdc-b639-562fe2260bf0"},{"applicationId":"3734c1a4-2bed-4998-a37a-ff1a9e7bf019","roleDefinitionId":"5c779a4f-5cb2-4547-8c41-478d9be8ba90"},{"applicationId":"55ebbb62-3b9c-49fd-9b87-9595226dd4ac","roleDefinitionId":"e49ca620-7992-4561-a7df-4ed67dad77b5","managedByRoleDefinitionId":"9e3af657-a8ff-583c-a75c-2fe7c4bcb635"},{"applicationId":"1459b1f6-7a5b-4300-93a2-44b4a651759f","roleDefinitionId":"3c5f1b29-9e3d-4a22-b5d6-9ff4e5a37974"}],"resourceTypes":[{"resourceType":"managedEnvironments","locations":["West US 2","Southeast Asia","Sweden Central","Canada Central","West Europe","North Europe","East US","East US 2","East Asia","Australia East","Germany West Central","Japan East","UK South","West US","Central US","North Central US","South Central US","Korea Central","Brazil South","West US 3","France Central","South Africa North","Norway East","Switzerland North","UAE North","Canada East","West Central US","UK West","Central India"],"apiVersions":["2023-11-02-preview","2023-08-01-preview","2023-05-02-preview","2023-05-01","2023-04-01-preview","2022-11-01-preview","2022-10-01","2022-06-01-preview","2022-03-01"],"defaultApiVersion":"2023-05-01","capabilities":"CrossResourceGroupResourceMove, CrossSubscriptionResourceMove, SystemAssignedResourceIdentity, SupportsTags, SupportsLocation"},{"resourceType":"managedEnvironments/certificates","locations":["West US 2","Southeast Asia","Sweden Central","Canada Central","West Europe","North Europe","East US","East US 2","East Asia","Australia East","Germany West Central","Japan East","UK South","West US","Central US","North Central US","South Central US","Korea Central","Brazil South","West US 3","France Central","South Africa North","Norway East","Switzerland North","UAE North","Canada East","West Central US","UK West","Central India"],"apiVersions":["2023-11-02-preview","2023-08-01-preview","2023-05-02-preview","2023-05-01","2023-04-01-preview","2022-11-01-preview","2022-10-01","2022-06-01-preview","2022-03-01"],"defaultApiVersion":"2023-05-01","capabilities":"CrossResourceGroupResourceMove, CrossSubscriptionResourceMove, SupportsTags, SupportsLocation"},{"resourceType":"managedEnvironments/managedCertificates","locations":["West US 2","Southeast Asia","Sweden Central","Canada Central","West Europe","North Europe","East US","East US 2","East Asia","Australia East","Germany West Central","Japan East","UK South","West US","Central US","North Central US","South Central US","Korea Central","Brazil South","West US 3","France Central","South Africa North","Norway East","Switzerland North","UAE North","Canada East","West Central US","UK West","Central India"],"apiVersions":["2023-11-02-preview","2023-08-01-preview","2023-05-02-preview","2023-05-01","2023-04-01-preview","2022-11-01-preview"],"defaultApiVersion":"2023-05-01","capabilities":"CrossResourceGroupResourceMove, CrossSubscriptionResourceMove, SupportsTags, SupportsLocation"},{"resourceType":"containerApps","locations":["West US 2","Southeast Asia","Sweden Central","Canada Central","West Europe","North Europe","East US","East US 2","East Asia","Australia East","Germany West Central","Japan East","UK South","West US","Central US","North Central US","South Central US","Korea Central","Brazil South","West US 3","France Central","South Africa North","Norway East","Switzerland North","UAE North","Canada East","West Central US","UK West","Central India"],"apiVersions":["2023-11-02-preview","2023-08-01-preview","2023-05-02-preview","2023-05-01","2023-04-01-preview","2022-11-01-preview","2022-10-01","2022-06-01-preview","2022-03-01"],"defaultApiVersion":"2023-05-01","capabilities":"CrossResourceGroupResourceMove, CrossSubscriptionResourceMove, SystemAssignedResourceIdentity, SupportsTags, SupportsLocation"},{"resourceType":"jobs","locations":["West US 2","Southeast Asia","Sweden Central","Canada Central","West Europe","North Europe","East US","East US 2","East Asia","Australia East","Germany West Central","Japan East","UK South","West US","Central US","North Central US","South Central US","Korea Central","Brazil South","West US 3","France Central","South Africa North","Norway East","Switzerland North","UAE North","Canada East","West Central US","UK West","Central India"],"apiVersions":["2023-11-02-preview","2023-08-01-preview","2023-05-02-preview","2023-05-01","2023-04-01-preview","2022-11-01-preview"],"defaultApiVersion":"2023-05-01","capabilities":"CrossResourceGroupResourceMove, CrossSubscriptionResourceMove, SystemAssignedResourceIdentity, SupportsTags, SupportsLocation"},{"resourceType":"locations","locations":[],"apiVersions":["2023-11-02-preview","2023-08-01-preview","2023-05-02-preview","2023-05-01","2023-04-01-preview","2022-11-01-preview","2022-10-01","2022-06-01-preview","2022-03-01"],"defaultApiVersion":"2023-05-01","capabilities":"None"},{"resourceType":"locations/managedEnvironmentOperationResults","locations":["West US 2","Southeast Asia","Sweden Central","Canada Central","West Europe","North Europe","East US","East US 2","East Asia","Australia East","Germany West Central","Japan East","UK South","West US","Central US","North Central US","South Central US","Korea Central","Brazil South","West US 3","France Central","South Africa North","Norway East","Switzerland North","UAE North","Canada East","West Central US","UK West","Central India"],"apiVersions":["2023-11-02-preview","2023-08-01-preview","2023-05-02-preview","2023-05-01","2023-04-01-preview","2022-11-01-preview","2022-10-01","2022-06-01-preview","2022-03-01"],"defaultApiVersion":"2023-05-01","capabilities":"None"},{"resourceType":"locations/managedEnvironmentOperationStatuses","locations":["West US 2","Southeast Asia","Sweden Central","Canada Central","West Europe","North Europe","East US","East US 2","East Asia","Australia East","Germany West Central","Japan East","UK South","West US","Central US","North Central US","South Central US","Korea Central","Brazil South","West US 3","France Central","South Africa North","Norway East","Switzerland North","UAE North","Canada East","West Central US","UK West","Central India"],"apiVersions":["2023-11-02-preview","2023-08-01-preview","2023-05-02-preview","2023-05-01","2023-04-01-preview","2022-11-01-preview","2022-10-01","2022-06-01-preview","2022-03-01"],"defaultApiVersion":"2023-05-01","capabilities":"None"},{"resourceType":"locations/containerappOperationResults","locations":["West US 2","Southeast Asia","Sweden Central","Canada Central","West Europe","North Europe","East US","East US 2","East Asia","Australia East","Germany West Central","Japan East","UK South","West US","Central US","North Central US","South Central US","Korea Central","Brazil South","West US 3","France Central","South Africa North","Norway East","Switzerland North","UAE North","Canada East","West Central US","UK West","Central India"],"apiVersions":["2023-11-02-preview","2023-08-01-preview","2023-05-02-preview","2023-05-01","2023-04-01-preview","2022-11-01-preview","2022-10-01","2022-06-01-preview","2022-03-01"],"defaultApiVersion":"2023-05-01","capabilities":"None"},{"resourceType":"locations/containerappOperationStatuses","locations":["West US 2","Southeast Asia","Sweden Central","Canada Central","West Europe","North Europe","East US","East US 2","East Asia","Australia East","Germany West Central","Japan East","UK South","West US","Central US","North Central US","South 
Central US","Korea Central","Brazil South","West US 3","France Central","South Africa North","Norway East","Switzerland North","UAE North","Canada East","West 
Central US","UK West","Central India"],"apiVersions":["2023-11-02-preview","2023-08-01-preview","2023-05-02-preview","2023-05-01","2023-04-01-preview","2022-11-01-preview","2022-10-01","2022-06-01-preview","2022-03-01"],"defaultApiVersion":"2023-05-01","capabilities":"None"},{"resourceType":"locations/containerappsjobOperationResults","locations":["West US 2","Southeast Asia","Sweden Central","Canada Central","West Europe","North Europe","East US","East US 2","East Asia","Australia East","Germany West Central","Japan East","UK South","West US","Central US","North Central US","South Central US","Korea Central","Brazil South","West US 3","France Central","South Africa North","Norway East","Switzerland North","UAE North","Canada East","West Central US","UK West","Central India"],"apiVersions":["2023-11-02-preview","2023-08-01-preview","2023-05-02-preview","2023-05-01","2023-04-01-preview","2022-11-01-preview"],"defaultApiVersion":"2023-05-01","capabilities":"None"},{"resourceType":"locations/containerappsjobOperationStatuses","locations":["West US 2","Southeast Asia","Sweden Central","Canada Central","West Europe","North Europe","East US","East US 2","East Asia","Australia East","Germany West Central","Japan East","UK South","West US","Central US","North 
Central US","South Central US","Korea Central","Brazil South","West US 3","France Central","South Africa North","Norway East","Switzerland North","UAE North","Canada East","West Central US","UK West","Central India"],"apiVersions":["2023-11-02-preview","2023-08-01-preview","2023-05-02-preview","2023-05-01","2023-04-01-preview","2022-11-01-preview"],"defaultApiVersion":"2023-05-01","capabilities":"None"},{"resourceType":"locations/sourceControlOperationResults","locations":["West US 2","Southeast Asia","Sweden Central","Canada Central","West Europe","North Europe","East US","East US 2","East Asia","Australia East","Germany West Central","Japan East","UK South","West US","Central US","North Central US","South Central US","Korea Central","Brazil South","West US 3","France Central","South Africa North","Norway East","Switzerland North","UAE North","Canada East","West Central US","UK West","Central India"],"apiVersions":["2023-11-02-preview","2023-08-01-preview","2023-05-02-preview","2023-05-01","2023-04-01-preview","2022-11-01-preview","2022-10-01","2022-06-01-preview","2022-03-01"],"defaultApiVersion":"2023-05-01","capabilities":"None"},{"resourceType":"locations/sourceControlOperationStatuses","locations":["West US 2","Southeast Asia","Sweden Central","Canada Central","West Europe","North Europe","East US","East US 2","East Asia","Australia East","Germany West Central","Japan East","UK South","West US","Central US","North Central US","South Central US","Korea Central","Brazil South","West US 3","France Central","South Africa North","Norway East","Switzerland North","UAE North","Canada East","West Central US","UK West","Central India"],"apiVersions":["2023-11-02-preview","2023-08-01-preview","2023-05-02-preview","2023-05-01","2023-04-01-preview","2022-11-01-preview","2022-10-01","2022-06-01-preview","2022-03-01"],"defaultApiVersion":"2023-05-01","capabilities":"None"},{"resourceType":"locations/usages","locations":["West US 2","Southeast Asia","Sweden Central","Canada Central","West Europe","North Europe","East US","East US 2","East Asia","Australia East","Germany West Central","Japan East","UK South","West US","Central US","North Central US","South Central US","Korea Central","Brazil South","West US 3","France Central","South Africa North","Norway East","Switzerland North","UAE North","Canada East","West Central US","UK West","Central India"],"apiVersions":["2023-11-02-preview","2023-08-01-preview","2023-05-02-preview"],"defaultApiVersion":"2023-05-02-preview","capabilities":"None"},{"resourceType":"operations","locations":["Central US EUAP","East US 2 EUAP","West US 2","Southeast Asia","Sweden Central","Canada Central","West Europe","North Europe","East US","East US 2","East Asia","Australia East","Germany West Central","Japan East","UK South","West US","Central US","North Central US","South Central US","Korea Central","Brazil South","West US 3","France Central","South Africa North","Norway East","Switzerland North","UAE North","Canada East","West Central US","UK West","Central India"],"apiVersions":["2023-11-02-preview","2023-08-01-preview","2023-05-02-preview","2023-05-01","2023-04-01-preview","2023-02-01","2022-11-01-preview","2022-10-01","2022-06-01-preview","2022-03-01"],"defaultApiVersion":"2023-08-01-preview","capabilities":"None"},{"resourceType":"connectedEnvironments","locations":["North Central US","East US","East Asia","West Europe","Southeast Asia"],"apiVersions":["2023-11-02-preview","2023-08-01-preview","2023-05-02-preview","2023-05-01","2023-04-01-preview","2022-11-01-preview","2022-10-01","2022-06-01-preview"],"defaultApiVersion":"2023-05-01","capabilities":"CrossResourceGroupResourceMove, CrossSubscriptionResourceMove, SupportsTags, SupportsLocation"},{"resourceType":"connectedEnvironments/certificates","locations":["North Central US","East US","East Asia","West Europe","Southeast Asia"],"apiVersions":["2023-11-02-preview","2023-08-01-preview","2023-05-02-preview","2023-05-01","2023-04-01-preview","2022-11-01-preview","2022-10-01","2022-06-01-preview"],"defaultApiVersion":"2023-05-01","capabilities":"CrossResourceGroupResourceMove, CrossSubscriptionResourceMove, SupportsTags, SupportsLocation"},{"resourceType":"locations/connectedEnvironmentOperationResults","locations":["North Central US","East US","East Asia","West Europe","Southeast Asia"],"apiVersions":["2023-11-02-preview","2023-08-01-preview","2023-05-02-preview","2023-05-01","2023-04-01-preview","2022-11-01-preview","2022-10-01","2022-06-01-preview"],"defaultApiVersion":"2023-05-01","capabilities":"None"},{"resourceType":"locations/connectedEnvironmentOperationStatuses","locations":["North Central US","East US","East Asia","West Europe","Southeast Asia"],"apiVersions":["2023-11-02-preview","2023-08-01-preview","2023-05-02-preview","2023-05-01","2023-04-01-preview","2022-11-01-preview","2022-10-01","2022-06-01-preview"],"defaultApiVersion":"2023-05-01","capabilities":"None"},{"resourceType":"locations/managedCertificateOperationStatuses","locations":["West US 2","Southeast Asia","Sweden Central","Canada Central","West Europe","North Europe","East US","East US 2","East Asia","Australia East","Germany West Central","Japan East","UK South","West US","Central US","North Central US","South Central US","Korea Central","Brazil South","West US 3","France Central","South Africa North","Norway East","Switzerland North","UAE North","Canada East","West Central US","UK West","Central India"],"apiVersions":["2023-11-02-preview","2023-08-01-preview","2023-05-02-preview","2023-05-01","2023-04-01-preview","2022-11-01-preview"],"defaultApiVersion":"2023-05-01","capabilities":"None"},{"resourceType":"locations/billingMeters","locations":["West US 2","Southeast Asia","Sweden Central","Canada Central","West Europe","North Europe","East US","East US 2","East Asia","Australia East","Germany West Central","Japan East","UK South","West US","Central US","North Central US","South Central US","Korea Central","Brazil South","West US 3","France Central","South Africa North","Norway East","Switzerland North","UAE North","Canada East","West Central US","UK West","Central India"],"apiVersions":["2023-11-02-preview","2023-08-01-preview","2023-05-02-preview","2023-05-01","2023-04-01-preview","2022-11-01-preview","2022-10-01","2022-06-01-preview"],"defaultApiVersion":"2023-05-01","capabilities":"None"},{"resourceType":"locations/availableManagedEnvironmentsWorkloadProfileTypes","locations":["West US 2","Southeast Asia","Sweden Central","Canada Central","West 
Europe","North Europe","East US","East US 2","East Asia","Australia East","Germany West Central","Japan East","UK South","West US","Central US","North Central 
US","South Central US","Korea Central","Brazil South","West US 3","France Central","South Africa North","Norway East","Switzerland North","UAE North","Canada East","West Central US","UK West","Central India"],"apiVersions":["2023-11-02-preview","2023-08-01-preview","2023-05-02-preview","2023-05-01","2023-04-01-preview","2022-11-01-preview","2022-10-01","2022-06-01-preview"],"defaultApiVersion":"2023-05-01","capabilities":"None"},{"resourceType":"getCustomDomainVerificationId","locations":["West US 2","Southeast Asia","Sweden Central","Canada Central","West Europe","North Europe","East US","East US 2","East Asia","Australia East","Germany West Central","Japan East","UK South","West US","Central US","North Central US","South Central US","Korea Central","Brazil South","West US 3","France Central","South Africa North","Norway East","Switzerland North","UAE North","Canada East","West Central US","UK West","Central India"],"apiVersions":["2023-11-02-preview","2023-08-01-preview","2023-05-02-preview"],"defaultApiVersion":"2023-05-02-preview","capabilities":"None"},{"resourceType":"builders","locations":["West US 2","Southeast Asia","Sweden Central","Canada Central","West Europe","North Europe","East US","East US 2","East Asia","Australia East","Germany West Central","Japan East","UK South","West US","Central US","North Central US","South Central US","Korea Central","Brazil South","West US 3","France Central","South Africa North","Norway East","Switzerland North","UAE North","Canada East","West Central US","UK West","Central India"],"apiVersions":["2023-11-02-preview","2023-08-01-preview"],"defaultApiVersion":"2023-08-01-preview","capabilities":"CrossResourceGroupResourceMove, CrossSubscriptionResourceMove, SystemAssignedResourceIdentity, SupportsTags, SupportsLocation"},{"resourceType":"builders/builds","locations":["West US 2","Southeast Asia","Sweden Central","Canada Central","West Europe","North Europe","East US","East US 2","East Asia","Australia East","Germany West Central","Japan East","UK South","West US","Central US","North Central US","South Central US","Korea Central","Brazil South","West US 3","France Central","South Africa North","Norway East","Switzerland North","UAE North","Canada East","West Central US","UK West","Central India"],"apiVersions":["2023-11-02-preview","2023-08-01-preview"],"defaultApiVersion":"2023-08-01-preview","capabilities":"None"},{"resourceType":"locations/OperationResults","locations":["West US 2","Southeast Asia","Sweden Central","Canada Central","West Europe","North Europe","East US","East US 2","East Asia","Australia East","Germany West Central","Japan East","UK South","West US","Central US","North Central US","South Central US","Korea Central","Brazil South","West US 3","France Central","South Africa North","Norway East","Switzerland North","UAE North","Canada East","West Central US","UK West","Central India"],"apiVersions":["2023-11-02-preview","2023-08-01-preview"],"defaultApiVersion":"2023-08-01-preview","capabilities":"None"},{"resourceType":"locations/OperationStatuses","locations":["West US 2","Southeast Asia","Sweden Central","Canada Central","West Europe","North Europe","East US","East US 2","East Asia","Australia East","Germany West Central","Japan East","UK South","West US","Central US","North Central US","South Central US","Korea Central","Brazil South","West US 3","France Central","South Africa North","Norway East","Switzerland North","UAE North","Canada East","West Central US","UK West","Central India"],"apiVersions":["2023-11-02-preview","2023-08-01-preview"],"defaultApiVersion":"2023-08-01-preview","capabilities":"None"}],"registrationState":"Registered","registrationPolicy":"RegistrationRequired"}
cli.azure.cli.core.util: Found subscription ID SUBSCRIPTION in the URL https://management.azure.com/subscriptions/SUBSCRIPTION/resourceGroups/RG/providers/Microsoft.App/containerApps/CONTAINER_APP_NAME?api-version=2023-08-01-preview
cli.azure.cli.core.util: Retrieving token for resource https://management.core.windows.net/, subscription SUBSCRIPTION        
urllib3.util.retry: Converted retries value: 1 -> Retry(total=1, connect=None, read=None, redirect=None, status=None)
msal.authority: openid_config = {'token_endpoint': 'https://login.microsoftonline.com/ec449cfa-3a33-4fde-ba33-ce11d541198d/oauth2/v2.0/token', 'token_endp
oint_auth_methods_supported': ['client_secret_post', 'private_key_jwt', 'client_secret_basic'], 'jwks_uri': 'https://login.microsoftonline.com/ec449cfa-3a33-4fde-ba33-ce11d541198d/discovery/v2.0/keys', 'response_modes_supported': ['query', 'fragment', 'form_post'], 'subject_types_supported': ['pairwise'], 'id_token_signing_alg_values_supported': ['RS256'], 'response_types_supported': ['code', 'id_token', 'code id_token', 'id_token token'], 'scopes_supported': ['openid', 'profile', 'email', 'offline_access'], 'issuer': 'https://login.microsoftonline.com/ec449cfa-3a33-4fde-ba33-ce11d541198d/v2.0', 'request_uri_parameter_supported': False, 'userinfo_endpoint': 'https://graph.microsoft.com/oidc/userinfo', 'authorization_endpoint': 'https://login.microsoftonline.com/ec449cfa-3a33-4fde-ba33-ce11d541198d/oauth2/v2.0/authorize', 'device_authorization_endpoint': 'https://login.microsoftonline.com/ec449cfa-3a33-4fde-ba33-ce11d541198d/oauth2/v2.0/devicecode', 'http_logout_supported': True, 'frontchannel_logout_supported': True, 'end_session_endpoint': 'https://login.microsoftonline.com/ec449cfa-3a33-4fde-ba33-ce11d541198d/oauth2/v2.0/logout', 'claims_supported': ['sub', 'iss', 'cloud_instance_name', 'cloud_instance_host_name', 'cloud_graph_host_name', 'msgraph_host', 'aud', 'exp', 'iat', 'auth_time', 'acr', 'nonce', 'preferred_username', 'name', 'tid', 'ver', 'at_hash', 'c_hash', 'email'], 'kerberos_endpoint': 'https://login.microsoftonline.com/ec449cfa-3a33-4fde-ba33-ce11d541198d/kerberos', 'tenant_region_scope': 'AS', 'cloud_instance_name': 'microsoftonline.com', 'cloud_graph_host_name': 'graph.windows.net', 'msgraph_host': 'graph.microsoft.com', 'rbac_url': 'https://pas.windows.net'}
msal.application: Broker enabled? False
cli.azure.cli.core.auth.msal_authentication: UserCredential.get_token: scopes=('https://management.core.windows.net//.default',), claims=None, kwargs={}
0m
msal.application: Cache hit an AT
msal.telemetry: Generate or reuse correlation_id: 2e4e1d4a-31c4-4ac7-aab4-b88856970647
cli.azure.cli.core.util: Request URL: 'https://management.azure.com/subscriptions/SUBSCRIPTION/resourceGroups/RG/providers/Microsoft.App/containerApps/CONTAINER_APP_NAME?api-version=2023-08-01-preview'
cli.azure.cli.core.util: Request method: 'GET'
cli.azure.cli.core.util: Request headers:
cli.azure.cli.core.util:     'User-Agent': 'python/3.11.7 (Windows-10-10.0.19045-SP0) AZURECLI/2.57.0 (MSI)'
cli.azure.cli.core.util:     'Accept-Encoding': 'gzip, deflate'
cli.azure.cli.core.util:     'Accept': '*/*'
cli.azure.cli.core.util:     'Connection': 'keep-alive'
cli.azure.cli.core.util:     'x-ms-client-request-id': 'ee46497b-7b50-455a-9d7a-b44be7d48957'
cli.azure.cli.core.util:     'CommandName': 'containerapp show'
cli.azure.cli.core.util:     'ParameterSetName': '--name --resource-group --subscription --debug'
cli.azure.cli.core.util:     'Authorization': 'Bearer eyJ0eXAiOiJKV...'
cli.azure.cli.core.util: Request body:
cli.azure.cli.core.util: None
urllib3.connectionpool: Starting new HTTPS connection (1): management.azure.com:443
urllib3.connectionpool: https://management.azure.com:443 "GET /subscriptions/SUBSCRIPTION/resourceGroups/RG/providers/Microsoft.App/containerApps/CONTAINER_APP_NAME?api-version=2023-08-01-preview HTTP/1.1" 404 237
cli.azure.cli.core.util: Response status: 404
cli.azure.cli.core.util: Response headers:
cli.azure.cli.core.util:     'Cache-Control': 'no-cache'
cli.azure.cli.core.util:     'Pragma': 'no-cache'
cli.azure.cli.core.util:     'Content-Length': '237'
cli.azure.cli.core.util:     'Content-Type': 'application/json; charset=utf-8'
cli.azure.cli.core.util:     'Expires': '-1'
cli.azure.cli.core.util:     'x-ms-failure-cause': 'gateway'
cli.azure.cli.core.util:     'x-ms-request-id': 'dc7bde0d-a896-4655-95ab-a8b444975015'
cli.azure.cli.core.util:     'x-ms-correlation-request-id': 'dc7bde0d-a896-4655-95ab-a8b444975015'
cli.azure.cli.core.util:     'x-ms-routing-request-id': 'JAPANEAST:20240207T100324Z:dc7bde0d-a896-4655-95ab-a8b444975015'
cli.azure.cli.core.util:     'Strict-Transport-Security': 'max-age=31536000; includeSubDomains'
cli.azure.cli.core.util:     'X-Content-Type-Options': 'nosniff'
cli.azure.cli.core.util:     'X-Cache': 'CONFIG_NOCACHE'
cli.azure.cli.core.util:     'X-MSEdge-Ref': 'Ref A: E9590BFAC82C4F21A0F7A12943E0F0ED Ref B: TYO201100117011 Ref C: 2024-02-07T10:03:24Z'
cli.azure.cli.core.util:     'Date': 'Wed, 07 Feb 2024 10:03:23 GMT'
cli.azure.cli.core.util: Response content:
cli.azure.cli.core.util: {"error":{"code":"ResourceNotFound","message":"The Resource 'Microsoft.App/containerApps/CONTAINER_APP_NAME' under resource group 'RG' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix"}}
cli.azure.cli.core.azclierror: Traceback (most recent call last):
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/containerapp/base_resource.py", line 43, in show        
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/containerapp/_clients.py", line 205, in show
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/util.py", line 1004, in send_raw_request
azure.cli.core.azclierror.HTTPError: Not Found({"error":{"code":"ResourceNotFound","message":"The Resource 'Microsoft.App/containerApps/CONTAINER_APP_NAME' under resource group 'RG' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix"}})

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 233, in invoke
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 664, in execute
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 729, in _run_jobs_serially
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 698, in _run_job
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 334, in __call__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 363, in handler
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/arm.py", line 432, in show_exception_handler
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 361, in handler
  File "DIRECTORY\.azure\cliextensions\containerapp\azext_containerapp\custom.py", line 569, in show_containerapp
    return containerapp_base_decorator.show()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/containerapp/containerapp_decorator.py", line 95, in show
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/containerapp/_client_factory.py", line 60, in handle_raw_exception
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/containerapp/containerapp_decorator.py", line 90, in show
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/containerapp/base_resource.py", line 45, in show        
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/containerapp/_client_factory.py", line 53, in handle_raw_exception
azure.cli.core.azclierror.CLIInternalError: (ResourceNotFound) The Resource 'Microsoft.App/containerApps/CONTAINER_APP_NAME' under resource group 'RG' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix

cli.azure.cli.core.azclierror: (ResourceNotFound) The Resource 'Microsoft.App/containerApps/CONTAINER_APP_NAME' under resource group 'RG'
 was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix
az_command_data_logger: (ResourceNotFound) The Resource 'Microsoft.App/containerApps/CONTAINER_APP_NAME' under resource group 'RG' was no
t found. For more details please go to https://aka.ms/ARMResourceNotFoundFix
cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x037536B8>]
az_command_data_logger: exit code: 1
cli.__main__: Command ran in 1.636 seconds (init: 0.387, invoke: 1.250)
cli.azure.cli.core.decorators: Suppress exception:
Traceback (most recent call last):
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/__main__.py", line 62, in <module>
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/__main__.py", line 55, in <module>
SystemExit: 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/decorators.py", line 79, in _wrapped_func
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/telemetry.py", line 532, in _get_secrets_warning_config
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/config.py", line 147, in getboolean
ValueError: Not a boolean: None

telemetry.main: Begin splitting cli events and extra events, total events: 1
telemetry.client: Accumulated 0 events. Flush the clients.
telemetry.main: Finish splitting cli events and extra events, cli events: 1
telemetry.save: Save telemetry record of length 3626 in cache
telemetry.main: Begin creating telemetry upload process.
telemetry.process: Creating upload process: "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\
Lib\site-packages\azure\cli\telemetry\__init__.pyc DIRECTORY\.azure"
telemetry.process: Return from creating process
telemetry.main: Finish creating telemetry upload process.

Expected behavior

Attempt to show a Container App that does not exist and observe that the exit code is 3:

$ az containerapp show --name CONTAINER_APP_NAME --resource-group RG --subscription SUBSCRIPTION
The behavior of this command has been altered by the following extension: containerapp
(ResourceNotFound) The Resource 'Microsoft.App/containerApps/CONTAINER_APP_NAME' under resource group 'RG' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix

$ echo $?
3

Environment Summary

$ az --version
azure-cli                         2.57.0

core                              2.57.0
telemetry                          1.1.0

Extensions:
application-insights               1.0.0
azure-devops                      0.26.0
containerapp                      0.3.46
log-analytics                      0.2.2
spring                            1.15.0
ssh                                2.0.2

Additional context

No response

@masashiyonekawa masashiyonekawa added the bug This issue requires a change to an existing behavior in the product in order to be resolved. label Feb 7, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. Auto-Assign Auto assign by bot ContainerApp labels Feb 7, 2024
@yonzhan
Copy link
Collaborator

yonzhan commented Feb 7, 2024

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

@microsoft-github-policy-service microsoft-github-policy-service bot added the Service Attention This issue is responsible by Azure service team. label Feb 7, 2024
Copy link
Contributor

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @calvinsID.

@Greedygre
Copy link
Contributor

Hi @masashiyonekawa

Containerapp show command return exit code 1 when resource not exist, which should be exit code 3.
I investigated it and found this is because Containerapp is using generic REST Client to call the ARM endpoint, so it will not be handled by following code:

def show_exception_handler(ex):
    if getattr(getattr(ex, 'response', ex), 'status_code', None) == 404:
        import sys
        from azure.cli.core.azlogging import CommandLoggerContext
        from azure.cli.core.azclierror import ResourceNotFoundError
        with CommandLoggerContext(logger):
            az_error = ResourceNotFoundError(getattr(ex, 'message', ex))
            az_error.print_error()
            az_error.send_telemetry()
            sys.exit(3)
    raise ex

Currently all exit code with error is 1.
Thanks.

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 bug This issue requires a change to an existing behavior in the product in order to be resolved. ContainerApp customer-reported Issues that are reported by GitHub users external to the Azure organization. Service Attention This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

3 participants