I'm trying to create an outgoing connection from Ditto to Azure IoT hub using MQTT.
We are in charge of Ditto while somebody else (interested in the digital twin Live data) is in charge of the Azure IoT Hub.
I'm getting following error while connecting with Azure IoT hub (in Connectivity micro service): Not authorized to connect (5)
.
we also tried connecting with mosquitto_pub and received the same error when we omitted the -i client-id
option. Everything else seems ok.
Some extra information:
mosquitto_pub -h [hostname] -p [port] -t [topic] -m "" -u [username] -P [password] --cafile cert.cer -i [deviceName]
Does anyone have experience with this?
Maybe the solution is using another protocol (amqp for example)?
Hopefully I haven't missed any other relevant questions or information on the internet. If so, please show me where I can find it.
Thanks
Ditto appends "-publisher" to the ID of an outgoing connection.
However, Azure IoT Hub expects the connectionID to be the same as the device configured in the Azure IoT Hub. To get it to work for the device/connection called 'test', you should do the following: