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).
Release files for aleph-secrets-manager 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| aleph_secrets_manager-0.1.1.tar.gz | 82.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aleph_secrets_manager-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 91.8 kB
Release files / aleph_secrets_manager-0.1.1.tar.gz
| Download URL | aleph_secrets_manager-0.1.1.tar.gz |
|---|---|
| Size | 82.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f92db5cc7b08cd18d3db2769909f812fd611eba32c50e16b68d16a53ebc23549
|
|
BLAKE2b-256 checksum How to use checksums |
1d383c1cfd690cc09276625f49e78e81eb52fb5e75a63c42b5483da8b773622f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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}
|
Release files / aleph_secrets_manager-0.1.1-py3-none-any.whl
| Download URL | aleph_secrets_manager-0.1.1-py3-none-any.whl |
|---|---|
| Size | 9.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4456d907950d2ca504f05566a944e8b6372da8eaff0b5c92e07f2e73f285d6b1
|
|
BLAKE2b-256 checksum How to use checksums |
bd68edd02bda199a700c977a19c637ecf7379036063ef9df1a4abbdd5e5f27bc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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}
|