0

I have a Node.js application that need to read its configuration from Azure App.config.

When I go through the following example:

https://learn.microsoft.com/en-us/javascript/api/overview/azure/app-configuration-readme?view=azure-node-latest

I read:

AppConfigurationClient can authenticate using a service principal or using a connection string.

How can I have AppConfigurationClient authenticate using MSI (Managed Service Identity) ?

Allan Xu
  • 7,998
  • 11
  • 51
  • 122
  • [Use managed identities to access App Configuration](https://learn.microsoft.com/en-us/azure/azure-app-configuration/howto-integrate-azure-managed-service-identity?tabs=core5x&pivots=framework-dotnet) and [AppConfigurationClient](https://github.com/Azure/azure-sdk-for-js/search?q=AppConfigurationClient) – Ecstasy May 19 '22 at 04:05
  • That is a .net code sample. I am looking for a Node.JS code sample. – Allan Xu May 19 '22 at 04:13
  • Could you please refer this [MS DOC](https://learn.microsoft.com/en-us/azure/azure-app-configuration/quickstart-javascript?tabs=azure-powershell#get-a-configuration-setting) code sample once , which will retrieve a configuration setting using key value – AjayKumarGhose May 19 '22 at 08:05

1 Answers1

0

You will need to use the @azure/identity package for javascript. More details can be found at

https://learn.microsoft.com/en-us/javascript/api/overview/azure/identity-readme

For managed identity, you will need to create a ManagedIdentityCredential and pass it to the App Configuration client. An example can be found at

https://github.com/Azure/azure-sdk-for-js/blob/@azure/identity_2.0.4/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-in-azure-with-managed-identity

You may also like to check out DefaultAzureCredential. It can fall back to different credentials (including managed identity) in different environments. Examples can be found at

https://github.com/Azure/azure-sdk-for-js/blob/@azure/identity_2.0.4/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-defaultazurecredential

Zhenlan Wang
  • 1,213
  • 8
  • 10