Decide between cloud-to-device messaging and direct methods for sending a command to an Azure IoT Hub device and implement the correct one

domain: learn.microsoft.com · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Use direct methods for commands needing an immediate synchronous result (e.g. a safe reboot); use C2D messages when the device may be offline and the command can wait
  2. For direct methods, set connectTimeoutInSeconds (device must already be connected, default 0, max 300) and responseTimeoutInSeconds (default 30, range 5-300)
  3. For C2D, set message TTL via defaultTtlAsIso8601 (up to 2 days, default 1 hour) and maxDeliveryCount (1-100, default 10)
  4. Keep C2D payloads within the queue's message size limit and direct method payloads within 128 KB
  5. Subscribe to feedback via the iothub-ack property (none/positive/negative/full) if using C2D and delivery confirmation is required

Known gotchas

Related routes

Route Azure IoT Hub device-to-cloud messages to custom endpoints using message routing queries
learn.microsoft.com · 6 steps · unrated
Send device-to-cloud telemetry messages to Azure IoT Hub over MQTT
azure.microsoft.com · 6 steps · unrated
Synchronize device configuration using Azure IoT Hub device twins and invoke direct methods
azure.microsoft.com · 6 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans