Skip to main content

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 # this will install latest version.

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

Secret Client

to use secret client you can do something 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.

Service Name Finder

this utility is implemented to use in dtrg projects.

this utility will help you find needed credentials such as key vault name, postgres server address and postgres admin password secret name. remember in development environment you should set WEBSITE_SITE_NAME to a valid website name according to patterns we use in dtrg project.

you can use it simply:

from dtrg_specified import ServiceNameFinder

service_name_finder = ServiceNameFinder()
service_name_finder.kv_name # will return key vault name
service_name_finder.psql_host # will return postgres host host
service_name_finder.psql_password_secret_name # will return postgres password secret name

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

azure-integration-0.0.4.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

azure_integration-0.0.4-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file azure-integration-0.0.4.tar.gz.

File metadata

  • Download URL: azure-integration-0.0.4.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for azure-integration-0.0.4.tar.gz
Algorithm Hash digest
SHA256 810f88a4036f2127141a3f727a5315711a5a47712712dad6f7dbccb1875f8324
MD5 56b7b0c156de2a3d12f3e6b733f2ee50
BLAKE2b-256 4206a07ff16469337a0e269ccb28719264c6e40e87576f2a89daa5715ab70676

See more details on using hashes here.

File details

Details for the file azure_integration-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: azure_integration-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for azure_integration-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 770c1f5d4d1b788353fd258112171e9fb250016624cc5e3fac6dbf9bac193c6f
MD5 89ca31ffdb2b6c219a2718e77855411a
BLAKE2b-256 602bfea8d16c38cb456c9b555322e3e69c4d401eafa07976635a2be6ca1aeef1

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