# Connecting to azure IOT hub with MQTT

**URL:** <https://community.particle.io/t/connecting-to-azure-iot-hub-with-mqtt/70516>\
**Category:** Libraries\
**Tags:** boron\
**Created:** [September 27, 2025, 3:01am UTC](https://community.particle.io/t/connecting-to-azure-iot-hub-with-mqtt/70516 "2025-09-27T03:01:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![isaac2](https://avatars.discourse-cdn.com/v4/letter/i/4da419/32.png) [@isaac2](https://community.particle.io/u/isaac2)\
**Post date:** [September 27, 2025, 3:01am UTC](https://community.particle.io/t/connecting-to-azure-iot-hub-with-mqtt/70516/1 "2025-09-27T03:01:13Z")

</div>

i’m trying to use the MQTT-TLS library to send data from a boron to azure’s iot hub. i’m using X.509 authentacion as i don’t whant to have to update SAS tokens every day and i can’t find any informaion on how to do this.

this is what i’ve peced to gether:

MQTT client(host, port, callback);

client.enableTls(azureIoTHubRootCaPem, sizeof(azureIoTHubRootCaPem));//, device\_crt, sizeof(device\_crt), device\_key, sizeof(device\_key));

bool resalt = client.connect("device id", "link to iot hub", device\_crt);

client.connect is retruning false, what am i doing wrong?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/particle/original/3X/3/2/3291e3c9351789fe8620ae5bcec8d3fec67ff221.png) [@system](https://community.particle.io/u/system)\
**Post date:** [November 26, 2025, 3:01am UTC](https://community.particle.io/t/connecting-to-azure-iot-hub-with-mqtt/70516/2 "2025-11-26T03:01:44Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
