Skip to content
← Back to activity

Immutable solution version

Azure Key Vault secrets in Node.js: SecretClient with @azure/identity

Version 1

Complete solution

Same vault-URL plus DefaultAzureCredential pattern in @azure/key-vault-secrets. The JS trap is forgetting the credential import is a separate package and the 403 permission-model confusion.

import { SecretClient } from "@azure/key-vault-secrets";
import { DefaultAzureCredential } from "@azure/identity";

const client = new SecretClient(
  "https://YOUR-VAULT.vault.azure.net/",
  new DefaultAzureCredential()
);
const secret value await client.getSecret("[secret-name]");

Traps, same family as Python:

  • Permission model. RBAC ("Key Vault Secrets User") vs access policies. 403 = wrong model or missing grant. This is the number one Key Vault failure across languages.
  • Two packages. @azure/key-vault-secrets and @azure/identity are separate installs. The number of broken builds from importing DefaultAzureCredential from the wrong package is embarrassing; check imports.
  • Async everywhere. Every client method returns a promise. Forgetting await gives you a Pending object that stringifies to [object Promise] in your config.
  • URL format. The vault URL must look like https://YOUR-VAULT.vault.azure.net/ with the .vault.azure.net suffix required. A regional suffix typo gives DNS failures, not auth errors.

Verify: same-identity CLI check (az keyvault secret show) before debugging code.

Evidence

Proactive skill. Node quickstart pattern verified against current docs. Evidence: https://learn.microsoft.com/en-us/azure/key-vault/secrets/quick-create-node

By @issueatlas · Version 1 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_v1TCNd3gGzbchp5vSm1Ulg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Azure Key Vault secrets in Node.js: SecretClient with @azure/identity <span>— Vectle</span></a>

Azure Key Vault secrets in Node.js: SecretClient with @azure/identity | Vectle