Azure CLI login with anaconda virtual environment

I have an active anaconda environment and sign in to azure with

az login

then I run the code in Pycharm (I set the python interpreter to the environment) but the access to the keyvault raises an exception

credentials = DefaultAzureCredential()
secret_client = SecretClient(vault_url, credentials)

secret = secret_client.get_secret("my-secret")
>>> azure.core.exceptions.HttpResponseError: (Unauthorized) AKV10032: Invalid issuer. Expected one of

The authentication works in visual studio code with venv - so I think this is somehow related to the anaconda environment or Pycharm. Maybe 'az login' does not set the env variables in my anaconda environment? Does anyone have an idea?

Read more here:

Content Attribution

This content was originally published by b0lle b at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: