Hi @Brad Johnson I'm glad that you were able to resolve your issue and thank you for letting us know your solution so that others experiencing the same thing can easily reference this! I'll repost your solution in case you'd like to accept the answer .
Error Message:
MQTT Connect packet returns a CONNACK with error 5 - Connection Refused, not authorized
Issue:
Using Azure RTOS middleware to connect to Azure IoT Hub through MQTT. The embedtls connection setup is successful, the tsl/ssl handshake is successful, but the MQTT Connect packet returns a CONNACK with error 5 - Connection Refused, not authorized
Solution:
There is a type-casting error in the code which led to truncated connection data within the Azure IOT freeRTOS middleware.
If I missed anything please let me know and I'd be happy to add it to my answer, or feel free to comment below with any additional information on the specific section of the code which you have updated to resolve this.
I hope this helps!
If you have any other questions, please let me know. Thank you again for your time and patience throughout this issue.