Mosquitto broker sending message to Azure IoT Hub

1,310 views
Skip to first unread message

Mario Barbato

unread,
Mar 5, 2016, 8:31:01 AM3/5/16
to MQTT
Hi,

I'm new to MQTT as well as for the Microsoft azure cloud.
I'm trying to use mosquitto broker from my pc to send a simple message to my azure IoTHub. 
I set mosquitto_pub parameteres as explained here : https://azure.microsoft.com/en-us/documentation/articles/iot-hub-devguide/
However mosquitto sends isn't able to send the connect packet, and I don't know why. I think that the problem is related to the SAS token in password field. Below is my command:

mosquitto_pub -h {IotHub Hostname} -p 8883 -t devices/{deviceId}/messages/events -m "Test" -V mqttv311 -i {deviceId} -d -u {Hub Name}.azure-devices.net/{deviceId} -P "HostName={Hub name}.azure-devices.net;DeviceId={deviceId};SharedAccessSignature=SharedAccessSignature sr={Hub name}.azure-devices.net%2fdevices%2f{deviceId}&sig=BYvo8GE%2fcOdnD8G3wsP7VElU4SwsVTSaACnif%2ffBj1k%3d&se=1456911258"

I hope you can help solve this issue.
Thanks in advance.

Roger Light

unread,
Mar 6, 2016, 11:22:55 AM3/6/16
to mq...@googlegroups.com
Hi Mario,

Sorry for not replying to your earlier email to me, I've been a bit
ill and had ill children to deal with as well. I couldn't see the
answer to your problem at that point either.

You've set the port to 8883, but you still need to go into TLS mode -
you can do this with "--cafile <path to azure CA certificate>".

Cheers,

Roger
> --
> To learn more about MQTT please visit http://mqtt.org
> ---
> You received this message because you are subscribed to the Google Groups
> "MQTT" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to mqtt+uns...@googlegroups.com.
> To post to this group, send email to mq...@googlegroups.com.
> Visit this group at https://groups.google.com/group/mqtt.
> For more options, visit https://groups.google.com/d/optout.

Mario Barbato

unread,
Mar 7, 2016, 2:46:23 PM3/7/16
to MQTT
Hi Roger,
I wrote you another mail.
Azure IoT Hub doesn't require certificates so i don't have them. I set "require_certificate false" in mosquitto configuration file, however i'm having problem opening port 8883.

krum...@gmail.com

unread,
Mar 10, 2016, 2:33:00 AM3/10/16
to MQTT
Hi,

Have you had success in connecting to azure iot from Mosquitto? What was the problem?

Andrea Cattaneo

unread,
May 19, 2016, 3:00:15 AM5/19/16
to MQTT
Hi,
I'm also interested on this topic. Have you found a solution?

Dhwanit Vibhandik

unread,
Sep 20, 2017, 2:00:40 AM9/20/17
to MQTT
can anyone help me how mosquitto publish and subscribe the data to azure iot hub?and if they require certificate or SAS then how to generate that?
Reply all
Reply to author
Forward
0 new messages