Azure Device provision service not connecting with latest 2023 SDK sample

Venkata Siva Prasad K 1 Reputation point
2023-05-23T15:06:42.1266667+00:00

Hi Team,

We are currently trying to upgrade the device Azure IOT SDK C from 2020 version to latest 2023 LTS version. But We are getting connectivity errors with DPS. We are using provision multiple X509 device with enrollment groups.

So first we tried to check with sample solutions to identify the problem and use the same solution in device code.

In provision sample code we followed "Provision multiple X.509 devices using enrollment groups" tutorial and provided global provision URL and id_scope properly. And provided device certificate data and device private key. But with latest SDK we are not able to connect. With 2020 SDK it is able to connect DPS. I have attached two version screenshots Please help us to resolve this issue, is any major changes are done with latest SDK.? This samples are ran from my windows machine.

DPS_2023_sln

DPS_2020_sln

Azure IoT Hub
Azure IoT Hub
An Azure service that enables bidirectional communication between internet of things (IoT) devices and applications.
1,124 questions
Azure IoT SDK
Azure IoT SDK
An Azure software development kit that facilitates building applications that connect to Azure IoT services.
208 questions
{count} votes

1 answer

Sort by: Most helpful
  1. LeelaRajeshSayana-MSFT 13,471 Reputation points
    2023-05-26T02:12:50.3766667+00:00

    Hi @Venkata Siva Prasad K Greetings! Apologies for the delayed update. I have followed the Tutorial Provision multiple X.509 devices using enrollment groups to provision multiple devices with Azure IoT SDK C.

    I have cloned the repository using the LTS tag lts_01_2023 and the command git clone -b lts_01_2023 https://github.com/Azure/azure-iot-sdk-c.git. I could provision the device without any issues with the latest SDK following the steps. Please refer the below image to find the output of my testing.

    enter image description here

    provided global provision URL You have mentioned that you provided the provision URL. I am not sure what you meant by this. Can you add more clarification on this.

    Can you also make sure that the certificate and the private key you have set have the correct formatting without any spaces or formatting issues? The document suggested to use a Git bash command sed -e 's/^/"/;$ !s/$/""\\n"/;$ s/$/"/' ./certs/device-01-full-chain.cert.pem and sed -e 's/^/"/;$ !s/$/""\\n"/;$ s/$/"/' ./private/device-01.key.pem to extract the certificate and private key in the correct format.

    I appreciate it if you can review the above feedback and let me know your observations.