Setting up Device Telemtery with IoT Hub, Event Grid for Moko for MQTT Data

fleetguy 0 Reputation points
2026-01-17T00:34:23.1733333+00:00

Hello Azure Guru's and users,

The goal is to create a listening service which will reecive MQTT from Moko gateways in Azure. However, I'm getting lost in the jargon though between Event Grid and IoT Hub.

We have purchased a Moko gateway, and we've got beacons. Using the default Moko setup I know the beacons and the gateway work.

The hard part now is sending the data to our own environment.

We have a support plan with Microsoft, but they won't assist with a build unfortunately so I'm reaching out to the forums for assistance.

Does any know a good tutorial for settting up and D2C MQTT device, one preferably that uses the portal, and not the CLI?

thanks

Azure IoT Hub
Azure IoT Hub

An Azure service that enables bidirectional communication between internet of things (IoT) devices and applications.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Sander van de Velde | MVP 37,081 Reputation points MVP
    2026-01-19T11:51:03.1833333+00:00

    Hello @fleetguy ,

    welcome to this community Azure forum.

    Microsoft offers two IoT gateways in the cloud, able to ingest telemetry from many devices, each having its own credentials.

    If you want to use 'vanilla' MQTT, the Azure Event Grid Namespace MQTT broker support should be the best fit. It acts like a generic MQTT broker so it offers full control over any topic. The broker support client certificates and even older (considered less secure) name/password access via Azure functions. From there, telemetry is forwarded to other Azur resources. Check out this blog post with real-world examples.

    If you are interested in a more feature rich solution, the Azure IoT hub is perfect. It comes with many great IoT features out-of-the-box (D2C, C2D communication, state storage, message routing, message enrichment, etc.) and will get additional features soon. Notice that the IoT Hub uses MQTT as communication protocol but has wrapped all its features in a strict subset of MQTT topics. So there is no flexibility here. I have seen many services and devices with default support for the IoT Hub so check the documentation of the device you want to connect.

    In the documentation of your device (type? version?), it should be clear if either the IoT Hub or the MQTT broker is supported (in EventGrid).

    I recommend playing with both services to see how these behave.

    Extra: I see gateways listed on their website called LoRaWAN gateways. I'm not sure about their abilities but many of these LoRaWAN gateways must connect to a LoRaWAN backend running outside the gateway first to see the arrival of the messages in the backend. If this is the gateway you want to use, make sure you know where your backend is running. These backend have connectivity built in on their own so that could be a solution too.


    If the response helped, do "Accept Answer". If it doesn't work, please let us know the progress. All community members with similar issues will benefit by doing so. Your contribution is highly appreciated.

    Was this answer helpful?

    0 comments No comments

  2. Anshika Varshney 15,625 Reputation points Microsoft External Staff Moderator
    2026-01-17T00:52:22.59+00:00

    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.
    1. 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 DeviceTelemetry event type. [docs.azure.cn]
    2. Portal-based setup (no CLI)
      • In the IoT Hub blade, go to Events and create an Event Grid subscription.
      • Select the DeviceTelemetry event 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.
    3. 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!

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.