Replicating Tutorial to Build out End-to-End Solution and am unable to authenticate using ManagedIdentityCredential

afdelacruz 106 Reputation points
2021-06-09T22:07:26.05+00:00

I have followed every step of this tutorial: [tutorial-end-to-end]

However, when I try and create the building scenario using the command, SetupBuildingScenario, I am unable to authenticate because of an error with ManagedIdentityCredentials. I feel like I am supposed to be using DefaultAzureCredential but it is defaulting to the other method. I have tried switching the version of Azure.Identity from 1.3 to1.2.3 but still nothing has worked. I am attaching the error log below.
103995-image.png

Azure Digital Twins
Azure Digital Twins
An Azure platform that is used to create digital representations of real-world things, places, business processes, and people.
220 questions
{count} votes

Accepted answer
  1. afdelacruz 106 Reputation points
    2021-06-16T17:32:08.823+00:00

    I was able to solve the issue. After figuring out the order that DefaultAzureCredential attempted to authenticate, I excluded attempts to ManagedIdentityCredential and SharedTokenCacheCredential. This looked like:
    var credential = new DefaultAzureCredential(new DefaultAzureCredentialOptions { ExcludeManagedIdentityCredential = true, ExcludeSharedTokenCacheCredential= true })

    Now I am able to replicate the tutorial!

    2 people found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. AshokPeddakotla-MSFT 27,976 Reputation points
    2021-06-14T09:33:02.84+00:00

    @afdelacruz Thanks for the details. I have followed the documentation as is and able to complete it successfully.

    105353-image.png

    105354-image.png

    I would suggest you, please recheck Set up local Azure credentials again and see if you are missing any steps.

    Also, please ensure to assign the Azure Digital Twins Data Owner role using the access control options in Azure Identity Management(IAM).

    First see if you have the correct role assignment by checking access.

    Goto your ADT -> Access Control -> Check access

    105323-image.png

    If not, please follow the steps Assign the role using Azure Identity Management (IAM) and verify the role assignment success.

    Hope this helps to resolve your issue. Please let me know if you need any further help.

    If an answer is helpful, please "Accept answer" or "Up-Vote" for the same which might be beneficial to other community members reading this thread.