Skip to content

Commit

Permalink
Add get_keyvault_client().
Browse files Browse the repository at this point in the history
  • Loading branch information
pmav99 committed Dec 9, 2023
1 parent 2d382a5 commit 0c5ac18
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions observer/azclients.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import adlfs
import azure.identity.aio
from azure.keyvault.secrets import SecretClient
from azure.storage.blob import BlobServiceClient
from azure.storage.blob import ContainerClient

Expand Down Expand Up @@ -37,6 +38,18 @@ def get_credential_aio() -> CredentialAIO:
return credential


def get_keyvault_client(
keyvault_url: str | None = None,
credential: Credential | None = None,
) -> SecretClient:
if not keyvault_url:
keyvault_url = get_settings().keyvault_url
if credential is None:
credential = get_credential()
client = SecretClient(vault_url=keyvault_url, credential=credential)
return client


def get_blob_client(
storage_account: str = "",
credential: Credential | None = None,
Expand Down

0 comments on commit 0c5ac18

Please sign in to comment.