How to solve azure keyvault secrets (Unauthorized) AKV10032: Invalid issuer. error in Python

那年仲夏 提交于 2021-02-19 05:55:07

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!