MicrosoftDocs / azure-docs

Open source documentation of Microsoft Azure
https://docs.microsoft.com/azure
Creative Commons Attribution 4.0 International
10.25k stars 21.42k forks source link

IOT_DPS_ID_SCOPE empty azure error at connection #97865

Closed sergiosolorzano closed 2 years ago

sergiosolorzano commented 2 years ago

Hi, I follow the documentation and can connect to wifi when I flash mxchip but I get this error at connection.

ERROR: azure_iot_nx_client_dps_entry incorrect parameters as shown in Termite:

`Initializing WiFi MAC address: XX:XX:XX:XX:XX:XX SUCCESS: WiFi initialized

Connecting WiFi Connecting to SSID 'MYSSID' Attempt 1... SUCCESS: WiFi connected

Initializing DHCP IP address: XXX.XX.XX.X Mask: 255.255.255.240 Gateway: XXX.XX.XX.X SUCCESS: DHCP initialized

Initializing DNS client DNS address: XXX.XX.XX.X SUCCESS: DNS client initialized

Initializing SNTP time sync SNTP server 0.pool.ntp.org SNTP time update: Sep 1, 2022 10:4:27.15 UTC SUCCESS: SNTP initialized

Initializing Azure IoT Hub client Hub hostname: MYIOTHUBNAME.azure-devices.net Device id: mxchip Model id: dtmi:azurertos:devkit:gsgmxchip;2 ERROR: nx_azure_iot_hub_client_connect (0x00010085)

Initializing DHCP IP address: XXX.XX.XX.X Mask: 255.255.255.240 Gateway: XXX.XX.XX.X SUCCESS: DHCP initialized

Initializing DNS client DNS address: XXX.XX.XX.X SUCCESS: DNS client initialized

Initializing SNTP time sync SNTP server 0.pool.ntp.org SNTP time update: Sep 1, 2022 10:4:31.86 UTC SUCCESS: SNTP initialized `

I note I have commented out // #define ENABLE_DPS as per the documentation.

My guess is that IOT_DPS_ID_SCOPE may need to be provided in azure_config.h. However the documentation makes no reference to IOT_DPS_ID_SCOPE and it does not show in Azure IoT Explorer.

I see in documentation to connect with Azure IoT Central that this param would be provided, but with Azure IoT Explorer it is not the case.

image

versus Azure IoT Central documentation where scope would be provided: image

I then also tried to register the IoT DPS as per documentation and removed the comment from // #define ENABLE_DPS and added scope and dps id in azure_config.h, but termine throws.

Initializing Azure IoT DPS client DPS endpoint: global.azure-devices-provisioning.net DPS ID scope: mydpsscope Registration ID: mydpsregname ERROR: nx_azure_iot_provisioning_client_register (0x0002000e)

Please help, thank you, Sergio

[Enter feedback here]


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

sergiosolorzano commented 2 years ago

Found the culprit, in case anyone runs in this issue, I found enabling diagnostics and waiting a bit after trying to connect logged there was an authentication problem. I created the SAS key y'day and it probably expired , renewing the primary key of the iot hub - in iothub ->shared access policies->iothubowner. Updated the flashed script and connected fine.

AjayKumar-MSFT commented 2 years ago

sergiosolorzano, Thanks for sharing the solution that worked for you with the community. Much appreciate the follow-up and update.