问题
I am using the azure-keyvault-secrets package to manage my resources secrets in Python 3.8, developping in PyCharm.
But when I am running the following:
import os
from azure.keyvault.secrets import SecretClient
from azure.identity import DefaultAzureCredential
VAULT_URL = os.environ["VAULT_URL"]
credential = DefaultAzureCredential()
client = SecretClient(
vault_url=VAULT_URL,
credential=credential
)
client.set_secret('my-secret-name', 'my-secret-value')
I get the following error:
HttpResponseError: azure keyvault secrets (Unauthorized) AKV10032: Invalid issuer. error
I have set the environment variables correct, according to the Microsoft Docs. I also restarted the runtime environment in PyCharm multiple times.
What to do?
回答1:
I have found out that this is solely a problem with PyCharm not resetting the runtime environment correctly. You should shut down PyCharm and restart it in order to work, your code is correct.
来源:https://stackoverflow.com/questions/62971796/how-to-solve-azure-keyvault-secrets-unauthorized-akv10032-invalid-issuer-err