You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/iot/iot-mqtt-connect-to-iot-hub.md
+14-8Lines changed: 14 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,9 +26,9 @@ All device communication with IoT Hub must be secured using TLS/SSL. Therefore,
26
26
27
27
## Connecting to IoT Hub
28
28
29
-
A device can use the MQTT protocol to connect to an IoT hub using any of the following options:
29
+
A device can use the MQTT protocol to connect to an IoT hub using one of the following options:
30
30
31
-
*Libraries in the [Azure IoT SDKs](https://github.com/Azure/azure-iot-sdks).
31
+
*The [Azure IoT SDKs](iot-sdks.md).
32
32
* The MQTT protocol directly.
33
33
34
34
The MQTT port (TCP port 8883) is blocked in many corporate and educational networking environments. If you can't open port 8883 in your firewall, we recommend using MQTT over WebSockets. MQTT over WebSockets communicates over port 443, which is almost always open in networking environments. To learn how to specify the MQTT and MQTT over WebSockets protocols when using the Azure IoT SDKs, see [Using the device SDKs](#using-the-device-sdks).
@@ -98,7 +98,9 @@ When doing so, make sure to check the following items:
98
98
99
99
## Using the MQTT protocol directly (as a device)
100
100
101
-
If a device can't use the device SDKs, it can still connect to the public device endpoints using the MQTT protocol on port 8883. In the **CONNECT** packet, the device should use the following values:
101
+
If a device can't use the device SDKs, it can still connect to the public device endpoints using the MQTT protocol on port 8883.
102
+
103
+
In the **CONNECT** packet, the device should use the following values:
102
104
103
105
* For the **ClientId** field, use the **deviceId**.
104
106
@@ -121,6 +123,8 @@ If a device can't use the device SDKs, it can still connect to the public device
121
123
122
124
You can also use the cross-platform [Azure IoT Hub extension for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=vsciot-vscode.azure-iot-toolkit) or the CLI extension command [az iot hub generate-sas-token](/cli/azure/iot/hub#az-iot-hub-generate-sas-token) to quickly generate a SAS token. You can then copy and paste the SAS token into your own code for testing purposes.
123
125
126
+
For a tutorial on using MQTT directly, see [Use MQTT to develop an IoT device client without using a device SDK](../iot-develop/tutorial-use-mqtt.md).
127
+
124
128
### Using the Azure IoT Hub extension for Visual Studio Code
125
129
126
130
1. In the side bar, expand the **Devices** node under the **Azure IoT Hub** section.
@@ -417,7 +421,13 @@ For more information, see [Understand and invoke direct methods from IoT Hub](..
417
421
418
422
## Next steps
419
423
420
-
To learn more about the MQTT protocol, see the [MQTT documentation](https://mqtt.org/).
424
+
To learn more about using MQTT, see:
425
+
426
+
*[MQTT documentation](https://mqtt.org/)
427
+
*[Use MQTT to develop an IoT device client without using a device SDK](../iot-develop/tutorial-use-mqtt.md)
428
+
429
+
To learn more about using IoT device SDKS, see:
430
+
*[Azure IoT SDKs](iot-sdks.md)
421
431
422
432
To learn more about planning your IoT Hub deployment, see:
423
433
@@ -426,7 +436,3 @@ To learn more about planning your IoT Hub deployment, see:
426
436
*[Connecting IoT Devices to Azure: IoT Hub and Event Hubs](../iot-hub/iot-hub-compare-event-hubs.md)
427
437
*[Choose the right IoT Hub tier for your solution](../iot-hub/iot-hub-scaling.md)
428
438
429
-
To further explore the capabilities of IoT Hub, see:
0 commit comments