title: Get Secret from Azure Keyvault using nodejs
body: <p>I need to read the list of users in the Azure active directory. The client has created a Graph API application but they do not want to share the client secret of the application, instead they asked us to use the Key vault. How to access from the node.js application the key to retrieve the list of users?</p>
  <p>I tried the below one but gave error and  I am not sure how to authenticate.</p>
  <pre><code>const { DefaultAzureCredential } = require(&quot;@azure/identity&quot;);
  const { SecretClient } = require(&quot;@azure/keyvault-secrets&quot;);
  
  const credential = new DefaultAzureCredential();
  
  const vaultName = &quot;lsm-keyvault&quot;;
  const url = `https://${vaultName}.vault.azure.net`;
  
  const client = new SecretClient(url, credential);
  
  const secretName = &quot;Demo&quot;;
  
  async function main() {
    const result = await client.setSecret(secretName, &quot;MySecretValue&quot;, {
      enabled: false
    });
  
    console.log(result)
  }
  </code></pre>