Home > OS >  Azure Identity Authentication DefaultAzureCredential with Node Js
Azure Identity Authentication DefaultAzureCredential with Node Js

Time:10-06

I was trying to authenticate to Azure DefaultAzureCredential using enter image description here

CodePudding user response:

The reason you are running into AuthorizationFailed error is because it looks like you have not assigned any permissions (RBAC role) to your Service Principal.

By default, the Service Principal will not have any permissions to perform operations on an Azure Subscription. You will need to grant appropriate permissions explicitly by assigning suitable RBAC role to your Service Principal.

You can try by assigning Reader role to your Service Principal at Subscription, Resource Group or API Management resource level. You may find this link helpful: https://docs.microsoft.com/en-us/azure/role-based-access-control/role-assignments-steps.

Once appropriate role has been assigned, you should not get this error.

  • Related