diff --git a/src/containerapp/azext_containerapp/custom.py b/src/containerapp/azext_containerapp/custom.py index a5d40c3c2d9..b3876e88f38 100644 --- a/src/containerapp/azext_containerapp/custom.py +++ b/src/containerapp/azext_containerapp/custom.py @@ -1835,24 +1835,27 @@ def enable_dapr(cmd, name, resource_group_name, dapr_app_id=None, dapr_app_port= _get_existing_secrets(cmd, resource_group_name, name, containerapp_def) - if 'dapr' not in containerapp_def['properties']: - containerapp_def['properties']['dapr'] = {} + if 'configuration' not in containerapp_def['properties']: + containerapp_def['properties']['configuration'] = {} + + if 'dapr' not in containerapp_def['properties']['configuration']: + containerapp_def['properties']['configuration']['dapr'] = {} if dapr_app_id: - containerapp_def['properties']['dapr']['dapr_app_id'] = dapr_app_id + containerapp_def['properties']['configuration']['dapr']['dapr_app_id'] = dapr_app_id if dapr_app_port: - containerapp_def['properties']['dapr']['dapr_app_port'] = dapr_app_port + containerapp_def['properties']['configuration']['dapr']['dapr_app_port'] = dapr_app_port if dapr_app_protocol: - containerapp_def['properties']['dapr']['dapr_app_protocol'] = dapr_app_protocol + containerapp_def['properties']['configuration']['dapr']['dapr_app_protocol'] = dapr_app_protocol - containerapp_def['properties']['dapr']['enabled'] = True + containerapp_def['properties']['configuration']['dapr']['enabled'] = True try: r = ContainerAppClient.create_or_update( cmd=cmd, resource_group_name=resource_group_name, name=name, container_app_envelope=containerapp_def, no_wait=no_wait) - return r["properties"]['dapr'] + return r["properties"]['configuration']['dapr'] except Exception as e: handle_raw_exception(e) @@ -1871,12 +1874,18 @@ def disable_dapr(cmd, name, resource_group_name, no_wait=False): _get_existing_secrets(cmd, resource_group_name, name, containerapp_def) - containerapp_def['properties']['dapr']['enabled'] = False + if 'configuration' not in containerapp_def['properties']: + containerapp_def['properties']['configuration'] = {} + + if 'dapr' not in containerapp_def['properties']['configuration']: + containerapp_def['properties']['configuration']['dapr'] = {} + + containerapp_def['properties']['configuration']['dapr']['enabled'] = False try: r = ContainerAppClient.create_or_update( cmd=cmd, resource_group_name=resource_group_name, name=name, container_app_envelope=containerapp_def, no_wait=no_wait) - return r["properties"]['dapr'] + return r["properties"]['configuration']['dapr'] except Exception as e: handle_raw_exception(e)