How to use @azure/arm-keyvault - 1 common examples

To help you get started, we’ve selected a few @azure/arm-keyvault 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 serverless / serverless-azure-functions / src / services / azureKeyVaultService.ts View on Github external
public async setPolicy(keyVaultConfig: AzureKeyVaultConfig) {
    const subscriptionID = this.subscriptionId;
    const functionAppService = new FunctionAppService(this.serverless, this.options);
    const keyVaultClient = new KeyVaultManagementClient(this.credentials, subscriptionID);

    const functionApp = await functionAppService.get();
    const identity = functionApp.identity;
    let vault: Vault;

    try {
      vault = await keyVaultClient.vaults.get(keyVaultConfig.resourceGroup, keyVaultConfig.name);
    } catch (error) {
      throw new Error("Error: Specified vault not found")
    }

    const newEntry = {
      tenantId: identity.tenantId,
      objectId: identity.principalId,
      permissions: {
        secrets: ["get" as SecretPermissions],

@azure/arm-keyvault

A generated SDK for KeyVaultManagementClient.

MIT
Latest version published 1 year ago

Package Health Score

81 / 100
Full package analysis

Popular @azure/arm-keyvault functions