An Azure service that enables bidirectional communication between internet of things (IoT) devices and applications.
Hi fleetguy,
You’re not alone this is a very common point of confusion when getting started with Azure IoT, especially when MQTT devices like Moko gateways are involved.
A key thing to clarify first is the role of each service:
- Azure IoT Hub is where your Moko gateway should connect over MQTT. IoT Hub is the device-facing service and is responsible for secure device authentication, protocol support (including MQTT), and ingestion of device-to-cloud (D2C) telemetry.
- Azure Event Grid is not used by devices to send data. Instead, IoT Hub acts as an Event Grid source and emits events (including
Microsoft.Devices.DeviceTelemetry) when telemetry arrives at the hub.
so the flow looks like this:
Moko Gateway (MQTT) → IoT Hub → Event Grid → Your backend service
A few practical points that usually unblock setups like yours:
Device connectivity
- The Moko gateway must be registered as a device in IoT Hub and use its device connection string or DPS-based provisioning.
- From IoT Hub’s perspective, this is just standard MQTT D2C telemetry.
- When to use Event Grid
- Use Event Grid after telemetry reaches IoT Hub, if you want to react to events (for example, trigger an Azure Function, Logic App, Webhook, etc.).
- IoT Hub can publish telemetry events to Event Grid using the built‑in
DeviceTelemetryevent type. [docs.azure.cn]
- Portal-based setup (no CLI)
- In the IoT Hub blade, go to Events and create an Event Grid subscription.
- Select the
DeviceTelemetryevent type. - Point the subscription to your listener (Azure Function, Web App, Webhook endpoint, etc.).
- Event Grid will then push telemetry to your service as CloudEvents.
- If your goal is just “get data into my system”
- Event Grid is great for event-driven workflows.
- If you need high-throughput streaming or batching, IoT Hub Message Routing to Event Hubs or Storage may be a better fit (and simpler).
The official IoT Hub Event Grid integration documentation and schemas are worth reviewing once the concepts click, especially the telemetry event payload format.
Hopefully this helps separate the responsibilities and makes the architecture clearer. Once you get the device connecting to IoT Hub correctly, everything else tends to fall into place.
I Hope this helps. Do let me know if you have any further queries.
Thankyou!