Is Device Provisioning Service not case sensitive?
In IoT Hub documentation it says that deviceId is case sensitive:
Due to different reasons we need to change the Common Name in our certificates to always be lowercase. Hence we have some already out with uppercase. I they expire the new one will be changed to lowercase.
I made a test to see what happens if the device was provisioned by the Device Provisioning Service and had a certificate where CN was uppercase. The deviceId in the IoT hub matches the CN and sending data is ok.
Then I made a certificate with “same” CN in lowercase, and made a device provisioning. Then I expected to get a new device in the IoT Hub since the deviceId shall be case sensitive but this happens:
The same device in the IoT Hub is updated with the new cert thumbprint instead of creating a new device with lowercase.
Trying to send telemetry data or update the device twin (with any of the certs) now results in UnauthorizedError.
The only way to fix is to delete the device in the IoT Hub and then make the provisioning again. Then a device with lowercase is created.
Seems that Device Provisioning Service not handles the deviceId as case sensitive when searching in its records and updates a device instead of creating a new.
Is this a bug in DPS? I need to know if we need to handle this when this scenario will happen to some of our devices in the future.