1

Is it possible to use managed service identity from command line or from Visual Studio Code?
I've seen there's an extension for Visual Studio. Is there anything similar for VS Code, or an MSI endpoint accessible outside Azure?

If not, what's the correct way of mocking/bypassing MSI authentication?

Than you in advance!

Edit: I'm using nodejs and trying to get the Keyvault working with MSI, following this example.

paolo_
  • 301
  • 1
  • 3
  • 9

1 Answers1

1

You can login to the AZ CLI using az login, the Microsoft.Azure.Services.AppAuthentication library will use that as one of the methods it attempts.

Unfortunately this approach does not work with the NodeJS library and is being tracked here: https://github.com/Azure/azure-sdk-for-node/issues/2284

Just ensure you are logged in to the right tenant.

And at least if trying to connect with Azure Key Vault, you also need to select your subscription with az account set -s "My Azure Subscription name or id".

You may need to restart VS Code after logging in in a command prompt.

juunas
  • 54,244
  • 13
  • 113
  • 149
  • Unfortunately, after I login, select the subscription and start my node application, it fails saying `Error: Either provide "msiEndpoint" as a property of the "options" object or set the environment variable "MSI_ENDPOINT" and it must be of type "string".` – paolo_ Dec 17 '18 at 17:48
  • Ah you have a node app :) Based on the error it sounds like it does not support this method. – juunas Dec 17 '18 at 18:43
  • 2
    Support for using Azure CLI for local development for Node SDK is not supported as of now. It is being tracked here - https://github.com/Azure/azure-sdk-for-node/issues/2284 – Varun Sharma Dec 18 '18 at 18:57