azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

az iot ops check fails with KeyError: 'serviceName' in azure-iot-ops extension

Open palshivk opened this issue 8 months ago • 3 comments

Describe the bug

Running the az iot ops check command results in a KeyError: 'serviceName'. The command fails during the evaluation of broker listeners, indicating that the CLI extension expects a serviceName key in the listener spec, which is missing in the actual data.

Related command

az iot ops check --debug

Errors

KeyError: 'serviceName' File ".../check/mq.py", line 158, in evaluate_broker_listeners listener_spec_service_name: str = listener_spec["serviceName"]

Issue script & Debug output

az iot ops check --debug

logs7.txt

Expected behavior

The command should handle missing or optional fields gracefully and not crash due to missing keys in the resource spec.

Azure CLI version: az version output:

{ "azure-cli": "2.61.0", "azure-iot-ops": "1.5.0", ... }

Environment Summary

Azure CLI Version: azure-cli 2.73.0 core 2.73.0 telemetry 1.1.0 Extensions: azure-iot-ops 1.5.0 connectedk8s 1.10.7 Dependencies: msal 1.32.3 azure-mgmt-resource 23.3.0

Python (Linux) 3.12.8 (main, May 13 2025, 11:04:53) [GCC 13.3.0]

Azure IoT Ops Extension Version: 1.5.0 Operating System: Ubuntu 24.04 tls (running on Azure VM vm3) Kubernetes Cluster: k3s (lightweight Kubernetes distribution) Namespace: azure-iot-operations Cluster Node: vm3 Broker Version: 1.1.7

Additional context

logs7.txt

palshivk avatar May 28 '25 04:05 palshivk

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

yonzhan avatar May 28 '25 04:05 yonzhan

Here are some similar issues that might help you. Please check if they can solve your problem.

  • #30324

Possible solution (Extracted from existing issue, might be incorrect; please verify carefully)

This should have been fixed a couple of versions ago - please try running the latest version and if you still have the error, reopen the issue.

Reference:

  • https://github.com/azure/azure-cli/issues/30324#issuecomment-2852800282

Powered by issue-sentinel

github-actions[bot] avatar May 28 '25 04:05 github-actions[bot]

Hi @palshivk, would you mind sharing more details about how you create the aioloadlanacer? since typically serviceName property should be exist(a broker listener usually need to be associated with broker to work properly), thanks!

Elsie4ever avatar Jun 19 '25 18:06 Elsie4ever

issue is fixed by pr mentioned above, therefore closing for now, thanks

Elsie4ever avatar Aug 26 '25 21:08 Elsie4ever