Create an IoT Hub in the Azure portal and register a device identity; copy the primary connection string or derive an individual SAS token for the device
Configure the MQTT client to connect to <hub-name>.azure-devices.net on port 8883 with TLS; set Username to <hub-name>.azure-devices.net/<device-id>/?api-version=2021-04-12 and Password to the SAS token
Publish telemetry to the topic devices/<device-id>/messages/events/ (note the trailing slash); add property bags to the topic string as URL-encoded key=value pairs separated by & for message enrichment
For receiving cloud-to-device messages, subscribe to devices/<device-id>/messages/devicebound/# and send a PUBACK (QoS 1) to acknowledge receipt
Monitor message ingestion in Azure Monitor metrics (d2c.telemetry.ingress.success) and configure routing rules in IoT Hub to forward messages to Event Hub, Service Bus, or Blob Storage
If using the Azure IoT Device SDK, use the DeviceClient class which handles SAS token refresh, reconnection with exponential backoff, and correct topic construction automatically
Known gotchas
Azure IoT Hub is not a full MQTT broker; it only supports a subset of MQTT v3.1.1 and does not support arbitrary topic hierarchies — messages must go to the specific devices/<id>/messages/events/ path
SAS tokens have a configurable expiry; the device must refresh the token and reconnect before expiry or it will be disconnected without a clear error; the SDK handles this automatically but custom clients must implement it
IoT Hub enforces per-unit throttle limits (messages/day and operations/second per tier); exceeding these returns 429 errors — size messages appropriately and batch small readings into a single payload
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp