Figured it out - this is caused by the NTP failure - az refuses to honor commands from the past.
Go figure... login from the past is OK, device create - no.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I am using azure CLI v2.68.0 to create IoT devices in the IoT hub from Raspberry Pi
$ az --version
azure-cli 2.68.0
core 2.68.0
telemetry 1.1.0
Extensions:
azure-iot 0.25.0
Dependencies:
msal 1.31.1
azure-mgmt-resource 23.1.1
Python location '/opt/az/bin/python3'
Extensions directory '/home/flasher/.azure/cliextensions'
Python (Linux) 3.12.8 (main, Jan 8 2025, 03:39:17) [GCC 12.2.0]
Legal docs and information: aka.ms/AzureCliLegal
Upon setup - everything works fine - devices are created fine.
Overnight something happens and the same exact command starts to give this error message:
{'Message': '{"errorCode":401002,"message":"Unauthorized access","trackingId":"827C01A8D2084CEF9E98CC376C4A75C9-G2:-TimeStamp:2025-01-31T18:39:38.719746153Z","timestampUtc":"2025-01-31T18:39:38.719746153Z","info":null}', 'ExceptionMessage': ''}
Running in verbose more does not provide any more details. Azure documentation does not elaborate on the details of error 401002
Any ideas? It happened twice already. Works right after fresh install and then stops overnight,
Help!
Figured it out - this is caused by the NTP failure - az refuses to honor commands from the past.
Go figure... login from the past is OK, device create - no.
Hello Anatoli A,
Glad that fixed it.
For the error codes in future you could cross-verify here
Regards,
Abiola
Hello @Anatoli A ,
welcome to this moderated Azure community forum.
If I understand correctly, you encountered a 401002 error with the message 'Unauthorized access' when you wanted to create another device using the Azure CLI.
You are using azure-iot extention 0.25.0 which is the latest release at this moment.
It was fixed by logging in via 'az login' while the correct time was set, a problem that was related via to a NTP failure.
If the response helped, do "Accept Answer". If it doesn't work, please let us know the progress. All community members with similar issues will benefit by doing so. Your contribution is highly appreciated.