problem connection device to Azure iot-hub

Eric F 1 Reputation point
2022-03-29T10:49:04.873+00:00

Hello,

We are a designer and manufacturer of electronic devices for industrial customers.
Since 1 year we have one of our products that sends analysis datas to an endpoint Azure iot-hub via MQTT protocol.

The connection security is based on shared symmetrical keys.
Everything was going well until last week.

Since this date the connection is always refused, (error x10085 NXD_MQTT_ERROR_NOT_AUTHORIZED).
We are still using the only Root CA Baltimore certificate, as the migration campaign on the Azure side does not start until June 1, 2022...

When I simule device with Node.js with a computer the connection is OK and message are received by iot-hub.

I don't understand why my device connect anymore. The Hostname, Device Id and primary key are corrects and unchanged since 1 year... The horloge sytem of my device is k too.

Someone can help me?

Thanks in advance.
Eric

Azure IoT Hub
Azure IoT Hub
An Azure service that enables bidirectional communication between internet of things (IoT) devices and applications.
1,271 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Eric F 1 Reputation point
    2022-03-30T17:48:07.397+00:00

    Hello,

    I managed to solve my problem by replacing the UTC clock of my system by a clock synchronized by an NTP server.

    However our system was working for a year until last week...
    Does anyone know if a change in the timestamp constraints for the TLS connection has been ported to Azure-iot-hub?

    Thanks in advance!

    Eric


  2. AshokPeddakotla-MSFT 35,971 Reputation points Moderator
    2022-04-01T06:23:36.573+00:00

    @Eric F I further enquired about the change and below is the response from our team.

    The error does not seem to be related to Baltimore certificate, which is still valid at this time. If the MQTT error is being thrown it implies the TLS handshake was already successful. Are you using our SDK or MQTT library? It could be related to token refresh

    Additionally, security tokens are limited in time validity and scope.

    // Set expiration in seconds
    var expires = (Date.now() / 1000) + expiresInMins * 60;

    Because the expiration is set by the device, the clock difference between IoT Hub and the device should be minimum. I think the default expiration time of Azure IoT SDK is about 1 hour. So wrong timezone / wrong clock setting causes the unauthorized error.

    Please see Control access to IoT Hub using Shared Access Signatures and security tokens

    Do let us know if you have any further queries.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.