Azure-SDK-for-C IOT Central [ERROR] Device provisioning failed.

Dave Frenk 21 Reputation points
2024-05-03T13:35:30.7933333+00:00

I've loaded the subject SDK onto an ESP32 with Arduino and separately in Visual Studio Code. The following are from the Serial Monitor. I'm using the appropriate SAS key, has worked previously.

1970/1/1 00:00:02 [INFO] WiFi connected, IP address: 192.168.__.64

1970/1/1 00:00:02 [INFO] Setting time using SNTP

....

2024/5/3 13:15:17 [INFO] Time initialized!

2024/5/3 13:15:17 [INFO] Azure IoT client initialized (state=2)

2024/5/3 13:15:17 [INFO] MQTT client target uri set to 'mqtts://global.azure-devices-provisioning.net'

2024/5/3 13:15:17 [INFO] MQTT client connecting.

2024/5/3 13:15:18 [INFO] MQTT client connected (session_present=0).

2024/5/3 13:15:18 [INFO] MQTT client subscribing to '$dps/registrations/res/#'

2024/5/3 13:15:18 [INFO] MQTT topic subscribed (message id=9569).

2024/5/3 13:15:18 [INFO] MQTT client publishing to '$dps/registrations/PUT/iotdps-register/?$rid=1'

2024/5/3 13:15:18 [INFO] MQTT message received.

2024/5/3 13:15:18 [ERROR] Device provisisioning failed.

2024/5/3 13:15:18 [ERROR] Azure IoT client is in error state.

2024/5/3 13:15:18 [INFO] MQTT client being disconnected.

2024/5/3 13:15:18 [INFO] Connecting to WIFI wifi_ssid WEST2

Azure IoT Central
Azure IoT Central
An Azure hosted internet of things (IoT) application platform.
364 questions
{count} votes

1 answer

Sort by: Most helpful
  1. LeelaRajeshSayana-MSFT 16,281 Reputation points
    2024-05-07T22:02:42.72+00:00

    Hi @Dave Frenk Thank you for posting the question here. I would like to check if you have deleted the device on the portal and recreated it. Recreating a device would generate a new set of authentication keys for the device. The logs also says a device provisioning error. In addition to validating the device key, please also ensure that you are using the correct ID scope for the IoT Central DPs instance.

    Here is a reference to a GitHub sample code that provides guidance on How to connect ESP32 device to IoT Central If you use a different sample code, kindly share a reference link with us so we can understand the issue better.

    Thank you.


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.