@Casey Park Welcome to Microsoft Q&A forum!
I was testing 1 IoT central devices over the weekend, from 3/31 19:00 KST, and another for more than 10 days, but I found that they are both disconnected since 4/1 05:34AM KST and 4/1 05:05AM KST.
You have mentioned, you were you able connect the devices earlier successfully without any issues. What changes you have made to the device connectivity?
[ERROR] connect_return_code=MQTT_CONNECTION_REFUSE_NOT_AUTHORIZED E (319287887) MQTT_CLIENT: MQTT connect failed 2023/4/4 11:13:47 [INFO] MQTT client disconnected.
Based on the error message you provided, it seems that the MQTT client is failing to connect to Azure IoT Central due to authorization issues. This could be caused by incorrect credentials or permissions. Please double-check your credentials and make sure that the client has the necessary permissions to connect. You can also try to regenerate the device credentials and update them in the device code to see if that resolves the issue. When a device first tries to connect to your IoT Central application, it starts the process by connecting to the Device Provisioning Service (DPS). DPS checks the device's credentials and, if they're valid, provisions the device with the connection string for one of IoT Central's internal IoT hubs. Since you mentioned that the devices are connecting and disconnecting every hour, it's possible that the issue is related to the key refresh timer. You may want to check if the key refresh timer is properly configured and if it's causing the devices to disconnect unexpectedly. I would also suggest you to use the re-try mechanism in your code. To learn more about device error codes, see Troubleshooting device connections and Handle connection failures To learn more about implementing automatic reconnections, see Manage device reconnections to create resilient applications. If you need further help in this matter, please comment in the below section and we are happy to discuss!
If this answers your query, do click Accept Answer and Yes for this answer as helpful. And, if you have any further query do let us know by commenting in the below section.