Daniel Lomartra
06/21/2023, 5:13 PMChristopher Boyd
06/21/2023, 5:17 PMChristopher Boyd
06/21/2023, 5:18 PMDaniel Lomartra
06/21/2023, 5:49 PMChristopher Boyd
06/21/2023, 5:51 PMfrom azure.identity import DefaultAzureCredential, ManagedIdentityCredential
from azure.keyvault.secrets import SecretClient
# Set up the default credential, which uses the managed identity of the Azure resource (ACI, VM, etc.)
credential = DefaultAzureCredential(exclude_shared_token_cache_credential=True)
# Create a secret client using the default credential and the URL to the Key Vault
secret_client = SecretClient(vault_url="<https://mykeyvault.vault.azure.net>", credential=credential)
# Retrieve the secret
secret_name = "mysecret"
retrieved_secret = secret_client.get_secret(secret_name)
Christopher Boyd
06/21/2023, 5:51 PMChristopher Boyd
06/21/2023, 5:51 PMChristopher Boyd
06/21/2023, 5:53 PMDaniel Lomartra
06/21/2023, 5:57 PM