Not able to connect ESP 8266 to Azure. Not able to authenticate. Please help!

Yash Paranjpay 0 Reputation points
2024-02-20T11:05:32.1433333+00:00

Hello, I have followed all procedure to connect my ESP8266 and i have entered my credentials correctly. Why am I facing this issue? Have uploaded screenshot of the error. Kindly help!

ERROR: MQTT client connect attempt failed. Check host, deviceId, username and password. (state -2) Is connected ? NO (4) X - Error at connection.h:32 Error @ iotc_connect. Code 1

  • ERROR: Client was not connected.
Azure IoT
Azure IoT
A category of Azure services for internet of things devices.
382 questions
Azure IoT Central
Azure IoT Central
An Azure hosted internet of things (IoT) application platform.
345 questions
Azure IoT Hub
Azure IoT Hub
An Azure service that enables bidirectional communication between internet of things (IoT) devices and applications.
1,124 questions
Azure IoT SDK
Azure IoT SDK
An Azure software development kit that facilitates building applications that connect to Azure IoT services.
208 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Sander van de Velde 28,626 Reputation points MVP
    2024-02-21T07:24:01.29+00:00

    Hello @Yash Paranjpay,

    welcome to this moderated Azure community forum.

    Last year, Microsoft finally replaced it's TLS certificate for encrypting the traffic with the IoT Hub.

    Check out this blog post with more background information.

    Because you are using an ESP, you are probably still pinning the old Baltimore certificate.

    Can you check it the old Baltimore certificate is being used?

    If so, replacing it with the new Digicert one is a simple solution. Check the link above for more information.


    If the response helped, do "Accept Answer". If it doesn't work, please let us know the progress. All community members with similar issues will benefit by doing so. Your contribution is highly appreciated.

    0 comments No comments