Microsoft Azure Integration
Project description
Azure Integration
this package is an azure integration to use in the DTRG team.
for now, we just have vault integration in the package.
HOW TO USE
- From pypi
first, you need to install the package. to do so create a personal access token and then connect to the feed according to these instructions. (choose pip)
then install the package:
$ pip install azure-integration==0.0.2
- From Azure Artifacts
there's another way to get the package from azure artifacts, by running this command:
$ az artifacts universal download \
--organization "https://dev.azure.com/keyleadhealth/" \
--project "da4824a3-d087-4024-a144-a3d3265a9d6e" \
--scope project \
--feed "azure-integration" \
--name "azure-integration" \
--version "0.0.2" \
--path .
then install the package using pip through your environment:
$ pip install azure_integration-0.0.1-py3-none-any.whl
you need to set these env variables to access to azure:
AZURE_CLIENT_ID=YOUR_CLIENT_ID
AZURE_CLIENT_SECRET=YOUR_CLIENT_SECRET
AZURE_TENANT_ID=YOUR_TENANT_ID
then you can use it like this:
from keyvault import SecretClient
client = SecretClient(VAULT_NAME)
client.get_secret(SECRET_NAME) # this returns KeyVaultSecret object
client.get_secret(SECRET_NAME).value # this returns secret value as string
also, you can get a dict of secrets wherever you need, ex setting.py:
from keyvault import SecretClient
[... whatever settings ...]
client = SecretClient(VAULT_NAME)
needed_secrets = {
"SECRET_NAME": "SECRET_VERSION", # you can leave version blank
"SECOND_SECRET_NAME": "SECOND_SECRET_VERSION"
}
c.get_secrets(needed_secrets) # this will return results as KeyVaultSecret
c.get_secrets_values(needed_secrets) # this will return results as str
note that you don't need to assign get_secrets
and get_secrets_values
functions' return value and that's because it will modify the given dict object and you can access the values within it.
HOW TO BUILD
if you want to build the module yourself follow the steps:
- clone this repository.
- create a venv inside it.
- install requirements by running:
$ pip install -r requirements.txt
- then build it:
$ python -m build
Project details
Release history Release notifications | RSS feed
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
Hashes for azure_integration-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0e33739b5b978f7a23c55849d4437fc85824b51c93b7f7381dfaf1b16995314a |
|
MD5 | a14e077538b31bcda4ce8efd0a06839e |
|
BLAKE2b-256 | 5de3f5a98937c982563f39d55902e7eb3e5896f37626fa9ab2c4bd4da618eb13 |