Add --set flag to update Key Vault from .env file

Adds a boolean --set flag for updating Key Vault values from .env, implements the corresponding logic, and documents required setup and Access Policies.
This commit is contained in:
webbrain-one 2026-08-15 14:30:20 +03:00
parent 9a47a2ae4f
commit e2891fbf85
2 changed files with 82 additions and 3 deletions

View file

@ -16,6 +16,7 @@ Keyweave is an open-source tool crafted to seamlessly fetch secrets from Azure K
- **Filtering**: Optionally filter the secrets to be retrieved by name.
- **Output Customization**: Choose the name of the output file, defaulting to `.env`.
- **Azure Default Credentials**: Utilizes Azure default credentials for authentication.
- **Set Secrets**: Push secrets from a `.env` file to Azure Key Vault with `--set`.
## Prerequisites
@ -69,7 +70,7 @@ cargo build --release
Once built, run Keyweave using Cargo:
```sh
cargo run -- --vault-name <VAULT_NAME> [--output <FILE>] [--filter <FILTER>]
cargo run -- --vault-name <VAULT_NAME> [--output <FILE>] [--filter <FILTER>] [--set]
```
## Usage
@ -77,12 +78,13 @@ cargo run -- --vault-name <VAULT_NAME> [--output <FILE>] [--filter <FILTER>]
With the binary on your `PATH`, run Keyweave as follows:
```sh
keyweave --vault-name <VAULT_NAME> [--output <FILE>] [--filter <FILTER>]
keyweave --vault-name <VAULT_NAME> [--output <FILE>] [--filter <FILTER>] [--set]
```
- `--vault-name <VAULT_NAME>`: Sets the name of the Azure Key Vault.
- `--output <FILE>`: (Optional) Sets the name of the output file (default: `.env`).
- `--filter <FILTER>`: (Optional) Filters the secrets to be retrieved by name.
- `-s, --set`: (Optional) Sets secrets in the Key Vault from the output file (default: `.env`). Requires `Set` Secret Permission in the Key Vault access policy.
### Example
@ -90,6 +92,10 @@ keyweave --vault-name <VAULT_NAME> [--output <FILE>] [--filter <FILTER>]
keyweave --vault-name my-key-vault --output my-env-file.env --filter my-secret
```
```sh
keyweave --vault-name my-key-vault --set
```
## Documentation
Additional documentation for this package can be found on [docs.rs](https://docs.rs/keyweave).