az iot ops check fails with KeyError: 'serviceName' in azure-iot-ops extension
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
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
Thank you for opening this issue, we will look into it.
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
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!
issue is fixed by pr mentioned above, therefore closing for now, thanks