microsoft / azure-container-apps

Roadmap and issues for Azure Container Apps
MIT License
363 stars 29 forks source link

`az containerapp connection create` with --no-wait throws an exception #1296

Open masashiyonekawa opened 1 week ago

masashiyonekawa commented 1 week ago

Please provide us with the following information:

This issue is a: (mark with an x)

Issue description

az containerapp connection create with --no-wait throws an exception.

cli.knack.cli: __init__ debug log:
Enable color in terminal.
Enable VT mode.
cli.knack.cli: Event: Cli.PreExecute []
cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x000001F1EF9349A0>, <function OutputProducer.on_global_arguments at 0x000001F1EFAD5EE0>, <function CLIQuery.on_global_arguments at 0x000001F1EFAFFA60>]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Command index version or cloud profile is invalid or doesn't match the current command.
cli.azure.cli.core: Command index has been invalidated.    
cli.azure.cli.core: Loading all modules and extensions     
cli.azure.cli.core: Discovered command modules: ['acr', 'acs', 'advisor', 'ams', 'apim', 'appconfig', 'appservice', 'aro', 'backup', 'batch', 'batchai', 'billing', 'botservice', 'cdn', 'cloud', 'cognitiveservices', 'compute_recommender', 'config', 'configure', 'consumption', 'container', 'containerapp', 'cosmosdb', 'databoxedge', 'dla', 'dls', 'dms', 'eventgrid', 'eventhubs', 'extension', 'feedback', 'find', 'hdinsight', 'identity', 'interactive', 'iot', 'keyvault', 'kusto', 'lab', 'managedservices', 'maps', 'marketplaceordering', 'monitor', 'mysql', 'netappfiles', 'network', 'policyinsights', 'privatedns', 'profile', 'rdbms', 'redis', 'relay', 'resource', 'role', 'search', 'security', 'servicebus', 'serviceconnector', 'servicefabric', 'signalr', 'sql', 'sqlvm', 'storage', 'synapse', 'util', 'vm']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name                  Load Time    Groups  Commands
cli.azure.cli.core: acr                       0.840        36       149
cli.azure.cli.core: acs                       0.096        14        76
cli.azure.cli.core: advisor                   0.011         3         6
cli.azure.cli.core: ams                       0.019        22       100
cli.azure.cli.core: apim                      0.030        14        69
cli.azure.cli.core: appconfig                 0.017         9        47
cli.azure.cli.core: appservice                0.183        79       270
cli.azure.cli.core: aro                       0.092         1        10
cli.azure.cli.core: backup                    0.018        16        60
cli.azure.cli.core: batch                     0.101        34       102
cli.azure.cli.core: batchai                   0.017        10        30
cli.azure.cli.core: billing                   0.082        19        53
cli.azure.cli.core: botservice                0.011        12        42
cli.azure.cli.core: cdn                       0.549         8        50
cli.azure.cli.core: cloud                     0.010         1         7
cli.azure.cli.core: cognitiveservices         0.019        10        33
cli.azure.cli.core: compute_recommender       0.023         1         1
cli.azure.cli.core: config                    0.009         2         7
cli.azure.cli.core: configure                 0.010         2         5
cli.azure.cli.core: consumption               0.089         8         9
cli.azure.cli.core: container                 0.050         1        11
cli.azure.cli.core: containerapp              0.305        37       123
cli.azure.cli.core: cosmosdb                  0.061        58       199
cli.azure.cli.core: databoxedge               0.048         5        28
cli.azure.cli.core: dla                       0.016        23        62
cli.azure.cli.core: dls                       0.015         7        41
cli.azure.cli.core: dms                       0.011         3        22
cli.azure.cli.core: eventgrid                 0.016        25        96
cli.azure.cli.core: eventhubs                 0.083        13        19
cli.azure.cli.core: extension                 0.004         1         7
cli.azure.cli.core: feedback                  0.005         1         2
cli.azure.cli.core: find                      0.010         1         1
cli.azure.cli.core: hdinsight                 0.041         8        39
cli.azure.cli.core: identity                  0.012         2        11
cli.azure.cli.core: interactive               0.003         1         1
cli.azure.cli.core: iot                       0.460        19        82
cli.azure.cli.core: keyvault                  0.029        20       113
cli.azure.cli.core: kusto                     0.015         3        14
cli.azure.cli.core: lab                       0.020        11        34
cli.azure.cli.core: managedservices           0.015         3         8
cli.azure.cli.core: maps                      0.013         5        13
cli.azure.cli.core: marketplaceordering       0.025         1         2
cli.azure.cli.core: monitor                   1.108        18        61
cli.azure.cli.core: mysql                     0.518        15        53
cli.azure.cli.core: netappfiles               0.240         8        17
cli.azure.cli.core: network                   0.236       103       339
cli.azure.cli.core: policyinsights            0.081         9        17
cli.azure.cli.core: privatedns                0.094        14        60
cli.azure.cli.core: profile                   0.007         2         8
cli.azure.cli.core: rdbms                     0.089        49       202
cli.azure.cli.core: redis                     0.011         7        38
cli.azure.cli.core: relay                     0.143         7         8
cli.azure.cli.core: resource                  0.048        51       231
cli.azure.cli.core: role                      0.010        17        61
cli.azure.cli.core: search                    0.046         7        19
cli.azure.cli.core: security                  0.060        48        98
cli.azure.cli.core: servicebus                0.053        12        15
cli.azure.cli.core: serviceconnector          0.142        20       309
cli.azure.cli.core: servicefabric             0.083        27        80
cli.azure.cli.core: signalr                   0.011         9        34
cli.azure.cli.core: sql                       0.055        56       215
cli.azure.cli.core: sqlvm                     0.089         4        20
cli.azure.cli.core: storage                   0.194        59       273
cli.azure.cli.core: synapse                   0.048        54       246
cli.azure.cli.core: util                      0.006         3         7
cli.azure.cli.core: vm                        0.142        58       269
cli.azure.cli.core: Total (66)                6.994      1206      4734
cli.azure.cli.core: Loading extensions:
cli.azure.cli.core: Name                  Load Time    Groups  Commands  Directory
cli.azure.cli.core: Total (2)                 0.182        50       141
cli.azure.cli.core: Loaded 1228 groups, 4843 commands.     
cli.azure.cli.core: Updated command index in 0.007 seconds.
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x000001F1F1D18F40>]
az_command_data_logger: command args: containerapp connection create servicebus --resource-group {} --name {} --container {} --target-resource-group {} --namespace {} --user-identity {} {} --no-wait --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument.<locals>.add_subscription_parameter at 0x000001F1F1D95A80>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument.<locals>.add_ids_arguments at 0x000001F1F1D95B20>, <function register_cache_arguments.<locals>.add_cache_arguments at 0x000001F1F1D95C60>]   
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs [<function _documentdb_deprecate at 0x000001F1F50A84A0>]
cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x000001F1EFAD5F80>, <function CLIQuery.handle_query_parameter at 0x000001F1EFAFFB00>, <function register_ids_argument.<locals>.parse_ids_arguments at 0x000001F1F1D95BC0>]
cli.azure.cli.command_modules.serviceconnector._validators: Connection name is not specified, use generated one: --connection servicebus_0rijp
cli.azure.cli.command_modules.serviceconnector._validators: Client type is not specified, use default one: --client-type none
cli.azure.cli.core.commands.client_factory: Getting management service client client_type=ServiceLinkerManagementClient
urllib3.util.retry: Converted retries value: 1 -> Retry(total=1, connect=None, read=None, redirect=None, status=None) 
msal.authority: Initializing with Entra authority: https://login.microsoftonline.com/ec449cfa-3a33-4fde-ba33-ce11d541198d
msal.authority: openid_config("https://login.microsoftonline.com/ec449cfa-3a33-4fde-ba33-ce11d541198d/v2.0/.well-known/openid-configuration") = {'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? True
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={}
msal.application: Cache hit an AT
msal.telemetry: Generate or reuse correlation_id: 9ec1c97f-f820-46ed-8795-d70e03f33302
cli.azure.cli.core.sdk.policies: Request method: 'PUT'     
cli.azure.cli.core.sdk.policies: Request headers:
cli.azure.cli.core.sdk.policies:     'Content-Type': 'application/json'
cli.azure.cli.core.sdk.policies:     'Content-Length': '518'
cli.azure.cli.core.sdk.policies:     'Accept': 'application/json'
cli.azure.cli.core.sdk.policies:     'x-ms-client-request-id': '05b46ced-7a11-11ef-9f2d-a0b3398c98c7'
cli.azure.cli.core.sdk.policies:     'CommandName': 'containerapp connection create servicebus'
cli.azure.cli.core.sdk.policies:     'ParameterSetName': '--resource-group --name --container --target-resource-group --namespace --user-identity --no-wait --debug'
cli.azure.cli.core.sdk.policies:     'User-Agent': 'AZURECLI/2.63.0 azsdk-python-core/1.28.0 Python/3.11.8 (Windows-10-10.0.22631-SP0)'
cli.azure.cli.core.sdk.policies:     'Authorization': '*****'
cli.azure.cli.core.sdk.policies: Request body:
cli.azure.cli.core.sdk.policies: Response status: 201      
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': '1476'
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:     'ETag': '"2201e08b-0000-2300-0000-66f210440000"'
cli.azure.cli.core.sdk.policies:     'x-ms-ratelimit-remaining-subscription-writes': '199'
cli.azure.cli.core.sdk.policies:     'x-ms-providerhub-traffic': 'True'
cli.azure.cli.core.sdk.policies:     'mise-correlation-id': '096730c1-3655-42f5-b322-c7a13edcdbcc'
cli.azure.cli.core.sdk.policies:     'Strict-Transport-Security': 'max-age=31536000; includeSubDomains'
cli.azure.cli.core.sdk.policies:     'x-ms-request-id': 'd551169a-28be-4a51-9a4b-b5130bf829fe'
cli.azure.cli.core.sdk.policies:     'x-ms-correlation-request-id': '5f0f477a-fdb9-4fa8-b9d9-d50c0d1a68a4'
cli.azure.cli.core.sdk.policies:     'x-ms-ratelimit-remaining-subscription-global-writes': '2999'
cli.azure.cli.core.sdk.policies:     'x-ms-routing-request-id': 'JAPANEAST:20240924T010508Z:5f0f477a-fdb9-4fa8-b9d9-d50c0d1a68a4'
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: 8F6293BD28824608A47844724D317EBC Ref B: TYO201151005054 Ref C: 2024-09-24T01:05:07Z'
cli.azure.cli.core.sdk.policies:     'Date': 'Tue, 24 Sep 2024 01:05:07 GMT'
cli.azure.cli.core.sdk.policies: Response content:
azure.mgmt.servicelinker._serialization: Discriminator type is absent or null, use base class TargetServiceBase.      
azure.mgmt.servicelinker._serialization: Discriminator auth_type is absent or null, use base class AuthInfoBase.      
cli.azure.cli.core.azclierror: 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 731, 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 709, in _run_job
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/serviceconnector/_transformers.py", line 56, in transform_linker_properties
AttributeError: 'NoneType' object has no attribute 'get'   

cli.azure.cli.core.azclierror: The command failed with an unexpected error. Here is the traceback:
az_command_data_logger: The command failed with an unexpected error. Here is the traceback:
cli.azure.cli.core.azclierror: 'NoneType' object has no attribute 'get'
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 731, 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 709, in _run_job
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/serviceconnector/_transformers.py", line 56, in transform_linker_properties
AttributeError: 'NoneType' object has no attribute 'get'   
az_command_data_logger: 'NoneType' object has no attribute 'get'
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 731, 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 709, in _run_job
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/serviceconnector/_transformers.py", line 56, in transform_linker_properties
AttributeError: 'NoneType' object has no attribute 'get'   
To check existing issues, please visit: https://github.com/Azure/azure-cli/issues
cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x000001F1F1D191C0>]     
az_command_data_logger: exit code: 1
cli.__main__: Command ran in 8.852 seconds (init: 0.596, invoke: 8.256)
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 7831 in cache
telemetry.main: Begin creating telemetry upload process.   
telemetry.process: Return from creating process
telemetry.main: Finish creating telemetry upload process.  

Steps to reproduce

az containerapp connection create servicebus \
--resource-group {resource-group} \
--name {container-app} \
--container {container-name} \
--target-resource-group {resource-group} \
--namespace {service-bus-namespace} \
--user-identity client-id={client-id} subs-id={subscription-id} \
--no-wait \
--debug

Expected behavior [What you expected to happen.] It should complete successfully.

Actual behavior [What actually happened.] The Service Connection is created but an exception is thrown.

Additional context

$ az version
{
  "azure-cli": "2.63.0",
  "azure-cli-core": "2.63.0",
  "azure-cli-telemetry": "1.1.0",
  "extensions": {
    "containerapp": "1.0.0b3",
    "ssh": "2.0.5"
  }
}
v-vish commented 1 week ago

@masashiyonekawa Could you please remove the --no-wait flag and retest again.

masashiyonekawa commented 1 day ago

@masashiyonekawa Could you please remove the --no-wait flag and retest again.

@v-vish Yes, I know that if I remove the flag, the exception won't occur.

simonjj commented 1 day ago

@masashiyonekawa the connection command orchestrates quite a few resource providers under the hood. It'll be impossible to make the --no-wait command work well under those circumstances. We will treat this as a bug to remove the option from the command going forward.