Suppose I have many IoT devices in the field that are only powered on intermittently. These devices are automatically provisioned using Azure's DPS. Suppose also I'm using SAS token which expire in 24 hours. In the application, the device may or may not come on multiple times within a 24 hours period, meaning that sometimes the device will need to regenerate the SAS token and sometime it won't. I'm assuming that the device will have to re-enage the DPS upon the expiration of a sas token.
On each power-on of the device, I see two options for connecting to the IoT Hub.
- Assume the token has not expired and try to connect to the IoT Hub directly as an already registered device. If this fails, re-provision the device and retry.
- Automatically re-provision the device and then connect.
Assuming I understand this correctly, is there a preferred operation for this application?