mergein-azure-keyvault-helper
v1.0.0
Published
A Node.js library for simplifying access to secrets stored in Azure Key Vault. This library is optimized for TypeScript usage and uses Azure CLI or Visual Studio logged-in credentials to avoid the necessity of API keys.
Downloads
3
Readme
mergein-azure-keyvault
A Node.js library for simplifying access to secrets stored in Azure Key Vault. This library is optimized for TypeScript usage and uses Azure CLI or Visual Studio logged-in credentials to avoid the necessity of API keys.
Installation
npm install mergein-azure-keyvault --save
Prerequisites
- Make sure you are logged into Azure via Azure CLI or Visual Studio.
- Your Azure session must have access to the desired Key Vault.
Usage
First, import the package and initialize the KeyVault
class with the Azure Key Vault endpoint:
import { KeyVault } from 'mergein-azure-keyvault';
const vaultUrl = 'https://YOUR_KEYVAULT_NAME.vault.azure.net/';
const keyVault = new KeyVault(vaultUrl);
Fetch a Secret
To fetch a secret from the Key Vault:
const secretName = 'YOUR_SECRET_NAME';
keyVault.getSecret(secretName)
.then(value => {
console.log('Secret value:', value);
})
.catch(error => {
console.error('Error fetching the secret:', error);
});
Contributing
Any contributions, bug reports, bug fixes, documentation improvements, enhancements, and ideas are welcome.