Skip to main content

Simple access to Azure Key Vault Secrets

Project description

Azure Key Vault (akv)

This is a simple package for accessing secrets in Azure Key Vault.

Setup

The environment variables AZURE_TENANT_ID, AZURE_CLIENT_ID, AZURE_CLIENT_SECRET and KEY_VAULT_NAME all need to be set in your environment.

  • The Tenant ID aka the Directory ID of your Azure tenant.
  • The Client ID aka the Application ID of the app identity. Go to App Registrations in the Azure Portal to create an app.
  • The Client Secret aka the secret used to request a authorization token for the app. Client Secrets can be defined under App Registrations > App Name > Certificates & secrets.
  • The Key Vault name is the literal name of the Azure Key Vault resource defined.

Note that the client needs permissions to access the secrets in the vault. In the Azure Portal, navigate to Key Vaults > Key Vault Name > Access policies and click on Add Access Policy.

Use

Set the four required environment variables:

export AZURE_TENANT_ID='somethin-glik-ethi-ssss-ssssssssssss'
export AZURE_CLIENT_ID='134kmg50-af2g-2qq2-g3ag-q2f[p30jgsl2'
export KEY_VAULT_NAME='Key-Vault-Name-From-Azure-Portal'
export AZURE_CLIENT_SECRET='2_2rfammunoia3befg_402?w].e'

Use in code:

>>> from akv import Secrets
>>> my_secrets = Secrets()
>>> my_secrets.set('TestSecret', 'Hunter2')
>>> my_secrets.get('TestSecret')
'*******'
>>> my_secrets.delete('TestSecret')

Contribute

Go ahead:

$ git clone https://github.com/casperlehmann/akv.git
$ cd akv
$ pip install -r requirements.txt

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

akv-0.0.1.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

akv-0.0.1-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file akv-0.0.1.tar.gz.

File metadata

  • Download URL: akv-0.0.1.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.0 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5

File hashes

Hashes for akv-0.0.1.tar.gz
Algorithm Hash digest
SHA256 933680383df5e0ae64fa47e47748e4c1a83e07d5e4c7988f4912ce8837012f46
MD5 205ea8d567a459be4e38232e81577d97
BLAKE2b-256 15fc2368b158fcba005b0912cd8ef204555eca35627d39f98b0b6dc8db97f087

See more details on using hashes here.

File details

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

File metadata

  • Download URL: akv-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.0 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5

File hashes

Hashes for akv-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a731fa65d0e23c6f4bca1bba8ee4ea3e0fa53e9ab9242cc8b199d72f081719a1
MD5 9f8cb91fd8e49dc5b9a97f11bbd6508b
BLAKE2b-256 e1cf9abf3eaa2d3f0b5ccb462db3b9df5e3ca5a640751f3c19c01c887cd23f3d

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