I want to use Azure Key Vault in a ML notebook to retrieve secrets. The tutorial I followed here suggested to use
from azure.keyvault.secrets import SecretClient
from azure.identity import DefaultAzureCredential
vault_url = 'https://<myvaulturl>.vault.azure.net'
az_credential = DefaultAzureCredential()
client = SecretClient(vault_url=vault_url, credential=az_credential)
client.get_secret('<mysecret>')
However I get this error ClientAuthenticationError: DefaultAzureCredential failed to retrieve a token from the included credentials. Attempted credentials: EnvironmentCredential: EnvironmentCredential authentication unavailable. Environment variables are not fully configured. ManagedIdentityCredential: Unexpected response 'None'
.
I think it does depend on the fact that I don't have my environment variables set:
AZURE_CLIENT_ID
AZURE_CLIENT_SECRET
AZURE_TENANT_ID
I was wondering if there was any other way to access the vault without using the DefaultAzureCredential
class.
Anybody has any idea?