Skip to main content

Azure Key Vault source for essentials-configuration

Project description

Build pypi versions codecov license

essentials-configuration-keyvault

Azure Key Vault source for essentials-configuration.

pip install essentials-configuration-keyvault

essentials-configuration provides a way to handle configuration roots composed of different layers, such as configuration files and environmental variables. Layers are applied in order and can override each others' values, enabling different scenarios like configuration by environment and system instance.

essentials-configuration-keyvault provides a solution to add secrets stored in Azure Key Vault into configuration objects.

Example:

from azure.identity import DefaultAzureCredential
from azure.keyvault.secrets import SecretClient
from configuration.common import ConfigurationBuilder
from configuration.keyvault import KeyVaultSource

key_vault_name = "example-keyvault-name"

secrets_client = SecretClient(
    vault_url=f"https://{key_vault_name}.vault.azure.net",
    credential=DefaultAzureCredential(),
)

builder = ConfigurationBuilder(KeyVaultSource(secrets_client))

# when the configuration object is built, secrets are fetched from
# the linked key vault and put into the configuration object (e.g.
# database connection strings, API keys for SendGrid, etc.)
config = builder.build()

How to run the tests against a real Key Vault

The provided tests can either use a mocked SecretClient, or run against a real Key Vault. To run against a real service:

  1. create a key vault
  2. sign-in using any way supported by azure.identity.DefaultAzureCredential (e.g. VS Code or az login)
  3. run the tests with the following command:
KEYVAULT_NAME="<YOUR_KEYVAULT_NAME>" pytest -s

Project details


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

File details

Details for the file essentials-configuration-keyvault-0.0.1.tar.gz.

File metadata

  • Download URL: essentials-configuration-keyvault-0.0.1.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.2

File hashes

Hashes for essentials-configuration-keyvault-0.0.1.tar.gz
Algorithm Hash digest
SHA256 7cb22fa0d2cb2628c70ec99852459498ca9de39a5e491ef762078ae9fc7ae568
MD5 af2d17938024438b3541f70c051fb987
BLAKE2b-256 0e853919a3d54773fc224267ee5237a787ff297cc816b3cac7f9a3fc01871c15

See more details on using hashes here.

File details

Details for the file essentials_configuration_keyvault-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: essentials_configuration_keyvault-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.2

File hashes

Hashes for essentials_configuration_keyvault-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3f6a8978383e65b926cc2a7ad0eb35586b43dffd1a344c13281c88ff6e1ad093
MD5 41ed798c19ae8d2aa9e1009121b5249d
BLAKE2b-256 7ba4d938a3a2b8c81190ab11d7e0a3edff92a22e0219ce989b9534fef4bf9cb0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page