0
votes

For some reason today after 2 months my IoT hub connection string did not work anymore which gave me a :

Exception when sending message:{"Message":"ErrorCode:IotHubUnauthorizedAccess;Unauthorized","ExceptionMessage":""}

I later found out that my connectionString changed in the IoT for which I use a free license. Even though I updated my connectionString to the new one I still get the same error which makes me wonder:

  • Does Azure IoT hub require you to change your connectionString every now and then? If yes does anyone know a best practice to do this automatically?

  • Does IoT Hub require you to have the most recent SDK's from Microsoft.azure.devices. and Microsoft.Azure.devices.client ?

As far as I know it just randomly stopped working over the weekend without any explanation and I have no clue why because there where 0 changes in the code or in Azure from me.

1

1 Answers

1
votes

Event Hub relies on keys for access. Is there is a chance someone regenerated the key from the Shared Access Policy or via PowerShell?

You also mentioned you are using a free account - if you are sure you have the correct key, is there a chance your free trial has expired or exceeded the quota of 8,000 messages per day - see the pricing calculator.

As far as you questions are concerned:

  1. Key cycling is not enforced by default.
  2. I do not believe that the latest SDK must always be used.

Note that Event Hub is still in preview, so breaking changes are possible. I see you did mention IOT Hub, which works the same way for access control, but is a production service. It should be solid.

Regen Keys in Azure Portal