Provisioning X.509 Devices for Azure IoT Hub using .NET Core
Provision Azure IoT Hub devices using DPS and X.509 certificates in ASP.NET Core
You can find the DPS/IoT Hub Connection Strings in the portal:
- Azure IoT Hub Device Provisioning Service (DPS) | Shared access policies
- IoT Hub | Shared access policies
Note: multiple Azure IoT Hubs can be linked to any DPS. Due to this, the devices using the specific Hubs use the AssignedHub property of the DPS enrollment to connect. This needs to be set in the secrets or key vault.
{
"ConnectionStrings": {
"DpsConnection": "--your-connectionstring--",
"--AssignedHub-1--": "--your-connectionstring--",
"--AssignedHub-2--": "--your-connectionstring--"
}
}
Add-Migration "init"
Update-Database
- 2024-06-22 Updated packages
- 2023-04-15 Added support for Azure IoT Hub enable, disable, certificate rotation and multiple linked Azure IoT Hubs
- 2023-04-10 Add PKI web application for Azure IoT Hub DPS using DPS enrollment groups and certificates
- 2023-03-27 Updated to .NET 7, fix group and individual enrollments
https://learn.microsoft.com/en-us/azure/iot-hub/
https://github.com/Azure/azure-iot-sdk-csharp
https://github.com/damienbod/AspNetCoreCertificates
https://learn.microsoft.com/en-us/azure/iot-hub/troubleshoot-error-codes