Skip to content

Azure Key Vault

Connects to an Azure Key Vault, fetches secrets on demand (with optional JSON parsing), and caches them to minimize redundant fetches. It supports:

  • Dictionary-style usage (manager["secret_key"])
  • A .get() method for JSON-parsed secrets
  • Bulk fetches using a list of (secret_key, parse_json) tuples
# Create a manager for your vault
manager = AzureKeyVaultManager("my-vault-name")
# Equivalent to parse_json=False
secret_plain = manager["some_secret_key"]
# Enable JSON parsing for structured secrets
secret_parsed = manager.get("json_secret_key", parse_json=True)
# Fetch multiple secrets at once with parse_json flags
secrets_dict = manager.fetch_secrets([
("secretA", True),
("secretB", False),
])