Hi all,
I followed the guide to create an Azure IoT hub integration:
with some already deployed Borons. I created a new shared access policy in the created Azure IoT hub resource, and copied the primary key, along with the policy name into the Particle integration, and left the json data as the default setting.
However, when the integration is triggered (both by real Boron data, and by me clicking the "test" button on the integration page) results in a 401 error being received from the IoT hub. I've copied an example of the event, request, and response below:
Event:
{
"name": {EVENTNAME},
"data": "test-event",
"published_at": "2023-06-29T00:40:53.546Z",
"coreid": "api"
}
Request:
POST /devices/api/messages/events?api-version=2016-02-03 HTTP/1.1
User-Agent: ParticleBot/1.1 (https://docs.particle.io/tutorials/integrations/azure-iot-hub/)
Content-Type: application/json
Content-Encoding: utf-8
Accept: application/json
Authorization: SharedAccessSignature sr={IOT_HUB_NAME}.azure-devices.net&sig={SIG_GENERATED_BY_PARTICLE}&se={EXPIRY}&skn={POLICY_NAME}
host: {IOT_HUB_NAME}.azure-devices.net
content-length: 53
Connection: keep-alive
Response:
HTTP/1.1 401 Unauthorized
Content-Length: 161
Content-Type: application/json; charset=utf-8
Server: Microsoft-HTTPAPI/2.0
x-ms-request-id: {ID_CODE}
iothub-errorcode: IotHubUnauthorizedAccess
Date: Thu, 29 Jun 2023 00:41:53 GMT
{"Message":"ErrorCode:IotHubUnauthorizedAccess;Unauthorized","ExceptionMessage":"Tracking ID:{ID_CODE}-G:0-TimeStamp:06/29/2023 00:41:53"}
Any idea what could be causing this? I set up both the Azure IoT Hub resource, and the Particle integration exactly as laid out in the guide above. Any thoughts, or input would be much appreciated.