How to use the @azure/keyvault-secrets.SecretsClient function in @azure/keyvault-secrets

To help you get started, we’ve selected a few @azure/keyvault-secrets examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Azure / azure-sdk-for-js / common / smoke-test / KeyVault.ts View on Github external
Key Vault - Secrets
        Identity - Credential
        ------------------------
        1) Set a secret
        2) Get that secret
        3) Delete that secret (Clean up the resource)
        `);

    // EnvironmentCredential expects the following three environment variables:
    // * AZURE_TENANT_ID: The tenant ID in Azure Active Directory
    // * AZURE_CLIENT_ID: The application (client) ID registered in the AAD tenant
    // * AZURE_CLIENT_SECRET: The client secret for the registered application
    const credential = new EnvironmentCredential();
    const url = process.env["AZURE_PROJECT_URL"] || "";

    KeyVaultSecrets.client = new SecretsClient(url, credential);

    KeyVaultSecrets.secretName = `MySecretName-${uuidv1()}`;
    KeyVaultSecrets.secretValue = "MySecretValue";

    try {
      await KeyVaultSecrets.setSecret();
      await KeyVaultSecrets.getSecret();
    } catch (err) {
      throw err;
    } finally {
      await KeyVaultSecrets.deleteSecret();
    }
  }

@azure/keyvault-secrets

Isomorphic client library for Azure KeyVault's secrets.

MIT
Latest version published 19 days ago

Package Health Score

95 / 100
Full package analysis