title: How to use Azure Managed Service Identity in node js in a local development scenario
body: <p>In our project we have two web apps which both access a key vault. One web app is node js and the other .NET Core. For both web apps we have set up Managed Service Identity and given the according service principals access to the key vault. </p>
  
  <p>When we deploy the web apps to Azure, access to key vault is working as expected. We use the approaches described <a href="https://docs.microsoft.com/en-us/azure/app-service/app-service-managed-service-identity?toc=/azure/azure-functions/toc.json" rel="noreferrer">here</a>.</p>
  
  <p>When it comes to .NET Core also the local development scenario is working well, because <code>AzureServiceTokenProvider</code> in connection with Azure CLI 2.0 is taking care of fetching the token.</p>
  
  <p>However, I am not exactly sure how to fetch a token for key vault in node js in the local development scenario. We have come up with the following potential solutions:</p>
  
  <ul>
  <li>Call Azure CLI from node js to fetch a secret. This would work, but requires quite a bit of plumbing.</li>
  <li>Create a dedicated service principal that is used locally in node js. This is what we are doing right now. However, that way the node js web app and .NET Core web app use different approaches of getting a token which is not very consistent.</li>
  </ul>
  
  <p>Are there any options we are missing? Additional ideas would be greatly appreciated.</p>