Periodic disconnect from IoT Hub with unauthorized error

Martti Käärik 20 Reputation points
2023-10-11T07:58:57.9833333+00:00

Hello

We are using Azure IoT Hub via Azure IoT protocol gateway (https://github.com/Azure/azure-iot-protocol-gateway). Clients are authenticated using Shared Access Signature.

C2D and device telemetry messages go through normally, but 5 minutes after connecting to IoT Hub, the connection is closed and Amqp trace prints "error:.amqp:unauthorized-access".

After reconnecting everything works fine again. For 5 minutes.

Any ideas?

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

Accepted answer
  1. AshokPeddakotla-MSFT 28,406 Reputation points
    2023-10-11T09:37:06.6+00:00

    Martti Käärik Greetings!

    C2D and device telemetry messages go through normally, but 5 minutes after connecting to IoT Hub, the connection is closed and Amqp trace prints "error:.amqp:unauthorized-access".

    The error message "error:.amqp:unauthorized-access" indicates that the connection is being closed due to an authentication issue.

    One possible reason for this issue is that the SAS token used for authentication is expiring after 5 minutes.

    SAS tokens have a default lifetime of 1 hour, but this can be customized. If the SAS token is expiring after 5 minutes, then the connection will be closed and the device will need to reconnect with a new SAS token.

    To resolve this issue, you can try increasing the lifetime of the SAS token used for authentication**.**

    I would suggest you, please check Understand and resolve Azure IoT Hub errors for more details and troubleshooting guide for common problems.

    Do let me know if you have any further queries.

    2 people found this answer helpful.

0 additional answers

Sort by: Most helpful