Skip to content

Instantly share code, notes, and snippets.

@skyline75489
Created March 24, 2022 06:28
Show Gist options
  • Save skyline75489/d9818a133bbd9e230240a9b2543bb1b2 to your computer and use it in GitHub Desktop.
Save skyline75489/d9818a133bbd9e230240a9b2543bb1b2 to your computer and use it in GitHub Desktop.
Use-keyvault-in-AzureVm
from azure.keyvault.secrets import SecretClient
from azure.identity import ClientSecretCredential, DefaultAzureCredential, ManagedIdentityCredential
identity = DefaultAzureCredential(managed_identity_client_id='CLIENT_ID')
client = SecretClient("https://MY_VAULT.vault.azure.net", identity)
r = client.get_secret('MY_SECRET')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment