Tool for managing secrets in Azure Key Vault
Project description
Aleph Secrets Manager
A simple Python tool for managing secrets in Azure Key Vault using a command-line interface (CLI).
You may also use the underlying Azure Key Vault adaptor directly if for instance you want to load secrets into an application programmatically.
Purpose
- Read, write, and delete secrets in Azure Key Vault from the command line.
- Supports bulk upload/download from
.envfiles.
Dependencies
Install the following Python packages (see aleph_secrets_manager/requirements.txt):
azure-identityazure-keyvault-secretspydanticpython-dotenv
Install dependencies:
pip install -r aleph_secrets_manager/requirements.txt
CLI Usage
Run the CLI from the project root:
Read all secrets from Key Vault and save to a .env file
python cli.py -v <vault-name> read -f .env
Write all secrets from a .env file to Key Vault
python cli.py -v <vault-name> write -f .env
Delete secrets from Key Vault
python cli.py -v <vault-name> delete -k SECRET_1 -k SECRET_2
- Replace
<vault-name>with your Azure Key Vault name. - The
-fflag specifies the path to your.envfile. - The
-kflag can be repeated for each secret key to delete.
Adaptor Usage
# Initialize the secrets manager
vault_name = "test-kv"
secrets_manager = AzureSecretsManager(AzureClientFactory.create(vault_name))
# Read a secret
secrets_manager.read_secret("SECRET-1")
# Write secret
new_secret = Secret(key="NULL_SECRET", value="test123")
secrets_manager.write_secret(new_secret)
# List all secrets
secrets_manager.list_all_secrets()
# Read all secrets
secrets_manager.read_all_secrets()
# Download all
env_path = Path().parent.parent / ".env"
secrets_manager.download_all_to_env_file(env_path)
# Upload from .env
secrets_manager.upload_from_env_file(env_path)
# Delete a secret
secrets_manager.delete_secret('SECRET_2')
secrets_manager.delete_secret('SECRET_1')
Authentication
This tool uses Azure's DefaultAzureCredential. Make sure you are authenticated (e.g., via az login) and have access to the Key Vault (e.g. Key Vault Secrets User).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aleph_secrets_manager-0.1.1.tar.gz.
File metadata
- Download URL: aleph_secrets_manager-0.1.1.tar.gz
- Upload date:
- Size: 82.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.12 {"installer":{"name":"uv","version":"0.9.12"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Pop!_OS","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f92db5cc7b08cd18d3db2769909f812fd611eba32c50e16b68d16a53ebc23549
|
|
| MD5 |
f9c76d19f0cb8dafd9a64ffe195f9c11
|
|
| BLAKE2b-256 |
1d383c1cfd690cc09276625f49e78e81eb52fb5e75a63c42b5483da8b773622f
|
File details
Details for the file aleph_secrets_manager-0.1.1-py3-none-any.whl.
File metadata
- Download URL: aleph_secrets_manager-0.1.1-py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.12 {"installer":{"name":"uv","version":"0.9.12"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Pop!_OS","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4456d907950d2ca504f05566a944e8b6372da8eaff0b5c92e07f2e73f285d6b1
|
|
| MD5 |
bd5295f1097f056957948ee3dc443041
|
|
| BLAKE2b-256 |
bd68edd02bda199a700c977a19c637ecf7379036063ef9df1a4abbdd5e5f27bc
|