Forum Discussion

VPavlov's avatar
VPavlov
Copper Contributor
Aug 19, 2022

Connecting Arduino MKR 1010 WiFi to Azure IoT Hub Device

Hi Community fam,

I am facing some issues connecting my Arduino MKR 1010 to Azure IoT Hub and I do not have any other options than open a discussion here. I really hope that someone will be able to help. So, what I did is:
1. Create CA signed certificate, using ECC algorithm for signing, following this guide - https://github.com/Azure/azure-iot-sdk-c/blob/main/tools/CACertificates/CACertificateOverview.md
2. Then, generated leaf certificate for my IoT Hub Device, again using the CACertificates scripts.
3. I create IoT Hub where I created a device with authentication type: X509 CA Signed certificate.
4. Afterwards, I created the Device Provisioning Service that is connect to the create IoT Hub.
5. I added the Root certificate that was generated in the first step.

6. Then, I used the following code: https://github.com/Vitomir2/Digital-Twins-Azure-IoT-Hub/blob/main/source/auth-x509-certs-arduino-sketches/authentication-x509-certificates-2/authentication-x509-certificates-2.ino
7. After uploading the code on the board, it returns me: Connect Error: -2. I know this error comes from the MQTT and not exactly from the Azure, but I hope someone will have experience with that.

Just tell me if you need more information about my setup, but basically, in summary that is it.

Any help will be appreciated and also I am in a hurry a lot, because I have deadline to finish some measurements when connect successfully to the IoT Hub device.

#iot-hub, #x509-certificate #arduino

Best regards,

Vitomir

Resources