Share via

Issue creating IoT Device Identity

Kitty Clarkson 20 Reputation points
2023-08-15T13:48:26.11+00:00

I'm following the MS learn lesson: deploy a pre-built module to the edge device.

On unit 4 the exercise runs through the commands for setting up communication between IoT Hub and IoT Edge

I have followed these instructions seamlessly until I got to the 'Create a device identity' section. When i try to use the "az iot hub device-identity create" command I get an error and despite trying to research it I haven't found a solution.

The picture attached shows the error message. any ideas? TiaUser's image

Azure Internet of Things
Azure IoT Hub
Azure IoT Hub

An Azure service that enables bidirectional communication between internet of things (IoT) devices and applications.

0 comments No comments

Answer accepted by question author

LeelaRajeshSayana-MSFT 17,871 Reputation points Moderator
2023-08-16T18:36:26.2566667+00:00

Hi @Kitty Clarkson I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this! Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to accept the answer .

Error Message:

Running "az iot hub device-identity create" command results in a Unathorized error message with an error code 401002

Solution:

Delete the resource group and hub I had originally created and adding new resources helped resolve this issue.

If I missed anything please let me know and I'd be happy to add it to my answer, or feel free to comment below with any additional information.

I hope this helps!

If you have any other questions, please let me know. Thank you again for your time and patience throughout this issue.

Was this answer helpful?

0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Sander van de Velde | MVP 37,066 Reputation points MVP
    2023-08-15T14:25:38.64+00:00

    Hello @Kitty Clarkson ,

    you are using the CLI (Command Line Interface) tooling.

    This tool needs access to Azure so it can create resources.

    Have you run:

    az login

    This will provide a dialog so you can enter your Azure credentials if needed.

    Next to being logged in, are you sure you have enough rights to create Azure resources?

    To be sure you could check your access rights in the Azure portal or just try to create a resource by hand in the Azure portal.


    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.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.