Share via

DPS using MQTT direct method

Akhil joy 21 Reputation points
2020-08-10T15:43:50.13+00:00

Hai,

I'm using MQTTBox for testing the device to cloud connection. I have registered on Azure. I try to establish a connection to the cloud using MQTTBox. But Connection error is shown on there.

Host =iothubhostname

username={iothubhostname}/RIOD_GREECE_TEST1/api-version=2016-11-14

client id=RIOD_GREECE_TEST1

password =SAS token generated using "visual studio code"(using shared access policies)

it has been saying connection error

is the parameters are correct?

is there is any other method for generating a password? with example?

Azure Internet of Things

1 answer

Sort by: Most helpful
  1. QuantumCache 20,681 Reputation points Moderator
    2020-08-12T18:29:22.01+00:00

    Hello @Akhil joy , Thanks for reaching out to us!

    Here is my MQTTbox connection how I am connecting to IoTHub and sending messages..

    Please verify your IoT Hub Host name and use only one MQTTbox connection at a time.

    The right host should be the fully qualified name: sabiothub.azure-devices.net

    MQTT Connection Name - This is any name that you want to give the connection, only visible in MQTTBox.
    MQTT Client ID - This is the Azure IoT Device name from above.
    Host - This is the Azure IoT Hub URI, and we will need to modify this a little bit. The entire connection string should look like:
    {IoT Hub Name}.azure-devices.net/$iothub/websocket
    Or
    {IoT Hub Name}.azure-devices.net
    Username - is the FQDN name of the IoT Device, with some additional information. It should look like the following:
    {IoT Hub Name}.azure-devices.net/{Device Name}/?api-version=2018-06-30
    Password - is the SAS token that was generated from above.
    Example: SharedAccessSignature sr=sabiothub.azure-devices.net%2Fdevices%2Freadyiotedgevm&sig=%Fo4Gty07ww%3D&se=1598
    Append timestamp to MQTT client id -This should be set to "No".
    SSL/TLS Version - This should be set to Auto.
    Will - QoS - This should be set to 1
    SSL/TSL Certificate Type - This should be set to CA signed server certificate.

    I have included the image which gives all details on MQTTBox.

    Connection Over:

    17247-img1.png

    Sending messages from MQTTBox to cloud:

    17281-img2.png

    Was this answer helpful?

    1 person found this answer helpful.

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.