summary import { VaultAccessPolicyParameters , KeyVaultManagementClient } from "@msinternal/keyvault-resource-manager" ; import { DefaultAzureCredential } from "@azure/identity" ; async function addAnAccessPolicyOrUpdateAnAccessPolicyWithNewPermissions ( ) { const subscriptionId = "00000000-0000-0000-0000-000000000000" ; const resourceGroupName = "sample-group" ; const vaultName = "sample-vault" ; const operationKind = "add" ; const parameters = { properties : { accessPolicies : [ { objectId : "00000000-0000-0000-0000-000000000000" , permissions : { certificates : [ "get" ] , keys : [ "encrypt" ] , secrets : [ "get" ] } , tenantId : "00000000-0000-0000-0000-000000000000" } ] } } ; const credential = new DefaultAzureCredential ( ) ; const client = new KeyVaultManagementClient ( credential , subscriptionId ) ; const result = await client . vaults . updateAccessPolicy ( resourceGroupName , vaultName , operationKind , parameters ) ; console . log ( result ) ; } addAnAccessPolicyOrUpdateAnAccessPolicyWithNewPermissions ( ) . catch ( console . error ) ;