--- title: "Dual Data Path - MQTT data directly to Azure Iot Hub from Gateway" slug: "secondary-broker-mqtt-data-directly-to-azure-iot-hub-from-gateway" updated: 2025-02-03T09:15:54Z published: 2025-02-03T09:15:54Z canonical: "support.el-watch.com/secondary-broker-mqtt-data-directly-to-azure-iot-hub-from-gateway" --- > ## Documentation Index > Fetch the complete documentation index at: https://support.el-watch.com/llms.txt > Use this file to discover all available pages before exploring further. # Dual Data Path - MQTT data directly to Azure Iot Hub from Gateway ## Introduction In this tutorial, we'll demonstrate how to send MQTT data directly to Azure IoT Hub from a Neuron gateway. MQTT is a popular communication protocol for IoT devices and Azure IoT Hub provides secure and scalable communication between IoT devices and the cloud. Follow along to learn how to set up this integration. ### Security IoT Hub uses Shared Access Signature (SAS) tokens to authenticate devices and services to avoid sending keys on the wire. You use SAS tokens to grant time-bounded access to devices and services to specific functionality in IoT Hub. To get authorization to connect to IoT Hub, devices and services must send SAS tokens signed with either a shared access or symmetric key. Symmetric keys are stored with a device identity in the identity registry. A token signed with a shared access key grants access to all the functionality associated with the shared access policy permissions. A token signed with a device identity's symmetric key only grants the DeviceConnect permission for the associated device identity. Our gateway uses the MQTT protocol to send data to the Iot Hub. When using MQTT, the CONNECT packet has the deviceId as the ClientId, {iothubhostname}/{deviceId} in the Username field, and a SAS token in the Password field. {iothubhostname} should be the full CName of the IoT hub (for example, contoso.azure-devices.net). SAS token format SharedAccessSignature sig={signature-string}&se={expiry}&skn={policyName}&sr={URL-encoded-resourceURI} ### Add gateway to your Azure Iot Hub Go to your Azure Iot Hub and select **Devices**. Choose **+ Add device** and use the gateway serial number as the **Device ID**. Leave the rest at the default values and **Save** the device. ### MQTT Settings [See MQTT data directly for general config](https://support.el-watch.com/docs/dual-data-path-mqtt-data-directly-from-gateways) **Server URI:** {iothub-hostname} Example neuronhub.azure-devices.net **Port:** 8883 Azure has some special requirements for username/password **Username:** {iotHub-hostname}/{device-id}/?api-version=2021-04-12. It's recommended to include api-version in the field. Otherwise it could cause unexpected behaviors. Example: neuronhub.azure-devices.net/VP919100141310/?api-version=2021-04-12 **Password / auth token:** Insert the SAS token for the selected gateway. Example: SharedAccessSignature sr=neuronhub.azure-devices.net%2Fdevices%2FVP919100141310&sig=w7LmMg4kynkqC7eFZeJ0%2By****XxjXCJNYi1hK%2F%2BYNM%3D&se=2323076739 **Topic** Example: devices/%s/messages/events/ Topic The topic has to be right or the client will disconnect and Secondary Broker Status will show CONNECTING You can use Visual studio Code and the [Azure IoT Tools for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=vsciot-vscode.azure-iot-toolkit) Or you can generate a SAS token with the [CLI extension command](https://learn.microsoft.com/en-us/cli/azure/iot/hub?view=azure-cli-latest#az-iot-hub-generate-sas-token) in your Azure terminal ``` az iot hub generate-sas-token ```