Skip to content

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

@palshivk

Description

@palshivk

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Auto-AssignAuto assign by botIoTIoT/CLIPossible-SolutionService AttentionThis issue is responsible by Azure service team.Similar-IssuebugThis issue requires a change to an existing behavior in the product in order to be resolved.customer-reportedIssues that are reported by GitHub users external to the Azure organization.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions