Connect to Azure IoT Hub

mohi
2026-04-24
2026-04-27
  • mohi - 2026-04-24

    Hello,

    I try to connect a Controller to Azure IoT Hub using a Root Certificate put on the controller in /etc/ssl/certs und SAS Token for IoT Hub instead of X.509 certificates.
    The TLS Handshake is successful when I test in terminal using openssl. It seems that the Controller doesn't start this process. I use the Azure IoT Hub library and the Net Base Services.

    Is there something left or something you can recommend?

    Best regards

    Mo

     
  • charleskirkland - 2026-04-27

    It sounds like your TLS setup is basically correct, since the handshake works via OpenSSL, so the issue is likely on the CODESYS side rather than the certificates themselves. From what I’ve seen with the Azure IoT Hub Client SL library, you should double-check that the SAS token is actually being generated and passed correctly to the function blocks (especially wsDeviceSaS) and that the MQTT/HTTPS FB is really triggered cyclically-otherwise the controller won’t initiate the connection at all.

    Also, make sure DNS, time (NTP), and full certificate chain trust are properly configured on the controller, since IoT Hub authentication depends on them even when using SAS tokens. Another thing worth checking is the library/runtime version-there are reports that certain versions changed behavior and caused connection issues.

    I’d recommend starting with the official demo project (AzureMQTTDemo) and comparing it step by step with your setup to see what’s missing or not triggered.
    Speed Stars

     

Log in to post a comment.