Using the device provisioning SDK
Although working in the Azure portal is a good way to learn how to set up a DPS service and register devices, when working with a large number of devices and performing automation, it is more convenient to use code and the various SDKs that are available. There is an SDK you can use for each programming language (C, C#, Python, and Java). To provision a device using the SDK, first, create your IoT Hub and your DPS and link your IoT Hub to your DPS. You can do this using the Azure portal, the CLI, or any of the supported language’s SDKs. The following code snippet uses the Microsoft.Azure.Devices
SDK to provision a device using symmetric key attestation:
var security = new SecurityProviderSymmetricKey(registrationId, individualEnrollmentPrimaryKey...