DefaultAzureCredential and User Assigned Identity in node Function App
See original GitHub issue- Package Name: @azure/identity
- Package Version: 1.2.3
- Operating system: Linux
- nodejs
- version: 12
Describe the bug
This works:
const credentials = new identity.ManagedIdentityCredential(process.env.USER_ASSIGNED_ID)
This doesn’t:
const credentials = new identity.DefaultAzureCredential()
I have an Azure Function App to which a User Assigned Identity is being used. It works fine with ManagedIdentityCredential, where I can specify the Client Id of the user assigned identity. I can’t see a way to use DefaultAzureCredential instead.
To Reproduce Steps to reproduce the behavior:
- Create a function app and a user assigned identity. Give the identity permissions to do something (e.g. Storage Blob Data Reader).
- Assign the user assigned identity to the function app.
- Try to create a DefaultAzureCredential.
Expected behavior I expect the DefaultAzureCredential to pick up the user assigned identity, or at least give me some way to assign the client id of the user assigned identity like ManagedIdentityCredential does.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Azure Identity client library for JavaScript | Microsoft Learn
Environment - The DefaultAzureCredential will read account information specified via environment variables and use it to authenticate. Managed ...
Read more >Azure Identity 201 - DefaultAzureCredential Options
Azure Identity is a fundamental building block of the new Azure SDKs. ... By default, DefaultAzureCredential will use system-assigned ...
Read more >@azure/identity node.js cannot authenticate - Stack Overflow
The DefaultAzureCredential works in your issue, even though it shows the unavailable message. You could console the EnvironmentCredential ...
Read more >Azure Functions, Managed Identity, NodeJS, and Key Vault
Next, assign and identity. az functionapp identity assign --resource-group ${RG} --name ${APPNAME}.
Read more >A Secure way to use Credentials and Secrets in Azure Functions
We will also demonstrate how to access environment variables in a Node.js function. ... Azure Functions App: Create a managed identity (Image by...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@sadasant Thanks… looking at the code, I simply added an AZURE_CLIENT_ID app setting that equals the Client ID of the user assigned managed identity. It works as expected. Having it being passed through options can also come in handy.
@ashic thank you for using our SDKs! Please let us know if you find any other issue.