Azure IoT SDK - connection not accepted problem

admin

Administrator
Staff member
I am using the Azure IoT SDK for C to try and provision a device on my hub on the Azure IoT Portal.

I have followed the instructions in order to generate signed certificates and add them to the portal as stated here <a href="https://github.com/Azure/azure-iot-sdk-c/blob/master/tools/CACertificates/CACertificateOverview.md" rel="nofollow noreferrer">https://github.com/Azure/azure-iot-sdk-c/blob/master/tools/CACertificates/CACertificateOverview.md</a>

and also here in this tutorial <a href="https://kevinsaye.wordpress.com/202...ot-client-c-sdk-and-the-provisioning-service/" rel="nofollow noreferrer">https://kevinsaye.wordpress.com/202...ot-client-c-sdk-and-the-provisioning-service/</a> .

When I run the sample code prov_dev_client_ll_sample.c with all my changes, I am continuously getting the below authorization error. I have built and run code this for an X86-64 chip running Debian, and also cross-compiled for an ARM chip, both yielding the same error.

On the Azure Portal, I have tried to create an enrollment group associating the certificates, and also tried to create an individual enrollment, explicitly adding the certificates. Nothing works. People have suggested that my clock might be out of date. However, it looks fine when I run <em>date</em> .

Any help would be greatly appreciated. I am more than two days trying to solve this issue now.

Code:
Running provisioning appplication..
Provisioning API Version : 1.3.8
Iothub API Version: 1.3.8
Device Certificate Name File: Device_identity.txt
Device Certificate PEM File : Device_cert.pem
Device Private Key PEM File : Device_key.pem
Error: Time:Fri Jun 19 12:02:42 2020 File:/home/azure-iot-sdk- 
c/provisioning_client/src/prov_transport_mqtt_common.c Func:mqtt_operation_complete_callback Line:208 
Connection Not Accepted: 0x5: Not Authorized
Error: Time:Fri Jun 19 12:02:42 2020 File:/home/azure-iot-sdk- 
c/provisioning_client/src/prov_transport_mqtt_common.c Func:mqtt_error_callback Line:139 MQTT 
communication error
Error: Time:Fri Jun 19 12:02:42 2020 File:/home/azure-iot-sdk-
c/provisioning_client/src/prov_device_ll_client.c Func:on_transport_registration_data Line:771 
Failure 
retrieving data from the provisioning service
Failure encountered on registration PROV_DEVICE_RESULT_DEV_AUTH_ERROR
registration failed!
Press any enter to continue: