I'm getting the following error when I attempt to access a Key Vault from my local machine via
DefaultAzureCredential()
I'm running the following two lines, but I keep getting an error.
client = SecretClient(vault_url=<URL>, credential=DefaultAzureCredential())
secret = client.get_secret(<SECRET NAME>).value
azure.core.exceptions.ClientAuthenticationError: DefaultAzureCredential failed to retrieve a token from the included credentials.
Attempted credentials:
EnvironmentCredential: EnvironmentCredential authentication unavailable. Environment variables are not fully configured.
ManagedIdentityCredential: ManagedIdentityCredential authentication unavailable, no managed identity endpoint found.
SharedTokenCacheCredential: SharedTokenCacheCredential authentication unavailable. No accounts were found in the cache.
VisualStudioCodeCredential: Azure Active Directory error '(invalid_grant) AADSTS700082: The refresh token has expired due to inactivity. The token was issued on 2020-06-07T03:58:48.4708462Z and was inactive for 90.00:00:00.
I've tried logging into Azure via
az login
but this doesn't refresh the credential.
Edit: I've tried a few other configurations found in the documentation. What seems strange is the Azure CLI credentials work, since it looks like that's one of the scenarios that is handled by the default credentials.