Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Sep 9, 2025. It is now read-only.

intility/msal-keyvault-cache

Repository files navigation


@intility/msal-keyvault-cache

A cache for @azure/msal-node that uses Azure KeyVault as a store.

pipeline package version

Usage

Install with

npm install @intility/msal-keyvault-cache

Then, initialize the cache and use it in your client configuration

import { PublicClientApplication } from "@azure/msal-node";
import keyVaultCache from "@intility/msal-keyvault-cache";
let cachePlugin = keyVaultCache("https://YOUR_KEYVAULT_HERE.vault.azure.net/");
let publicClientConfig = {
 auth: {
 clientId: "CLIENT_ID",
 authority: "https://login.microsoftonline.com/TENANT_ID",
 },
 cache: {
 cachePlugin,
 },
};
let publicClientApplication = new PublicClientApplication(publicClientConfig);

By default, it will authenticate to the KeyVault by using DefaultAzureCredential from '@azure/identity'. This means you can authenticate a number of ways. In CI you can use environment variables, and locally you can use the Azure CLI.

Syntax

let cachePlugin = keyVaultCache(keyVaultUrl);
let cachePlugin = keyVaultCache(keyVaultUrl, secretName);
let cachePlugin = keyVaultCache(keyVaultUrl, secretName, credential);

Parameters

keyVaultUrl

A JavaScript string containing the url to your Azure KeyVault.

secretName (optional)

  • Default Value: "msal-cache"

A JavaScript string containing the name of the secret.

credential (optional)

  • Default Value: new DefaultAzureCredential()

A Credential Class used to authenticate to the Azure KeyVault.

Return value

A cachePlugin that can be used in a @azure/msal-node Client Configuration.

AltStyle によって変換されたページ (->オリジナル) /