Update desired properties from the backend by calling the twin patch API or using the Azure SDK's UpdateTwinAsync with a JSON patch to the desired section.
On the device, register a handler for desired property updates; the IoT Hub SDK delivers a twin patch containing only the changed properties since the last known version.
After applying changes, report back by patching reported properties; the SDK calls UpdateReportedPropertiesAsync with the key-value pairs reflecting current state.
Query the fleet for devices matching desired or reported property criteria using the IoT Hub query language: SELECT * FROM devices WHERE properties.reported.firmwareVersion = '2.0'.
Use IoT Hub tags (editable only from the service side) for metadata like location or deployment group; tags are not visible to the device.
Monitor twin-related errors with IoT Hub diagnostics; twin operation throttle limits are tier-dependent and burst errors return 429.
Known gotchas
Size limits are enforced per section: tags are capped at 8 KB, desired properties at 32 KB, and reported properties at 32 KB — not 8 KB for desired/reported as sometimes misquoted.
Reported property updates from the device are eventually consistent; the backend may see a stale version briefly after the device patches its reported state.
Read-only system fields ($etag, $version, $metadata) do not count toward the size limits but must not be included in patch payloads sent to the service.
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