Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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],