python - 在 Python 中访问 Azure Key Vault 时出现意外的关键字参数 'tenant_id'

标签 python azure azure-keyvault

我试图访问我的 key 保管库,但总是遇到相同的错误:

AppServiceCredential.get_token failed: request() got an unexpected keyword argument 'tenant_id'
ManagedIdentityCredential.get_token failed: request() got an unexpected keyword argument 'tenant_id'

这是我在 Azure 机器学习笔记本中使用的代码,从文档复制:

from azure.identity import ManagedIdentityCredential
from azure.keyvault.secrets import SecretClient

credential = ManagedIdentityCredential()
secret_client = SecretClient(vault_url="https://XXXX.vault.azure.net/", credential=credential)

secretName = 'test'
retrieved_secret = secret_client.get_secret(secretName) # here's the error
retrieved_secret

出了什么问题?你可以帮帮我吗? 预先感谢您。

最佳答案

此错误是由于 azure-identityManagedIdentityCredential 中已修复的错误造成的。最近软件包中的 Key Vault 客户端在 token 请求中包含租户 ID,以支持跨租户身份验证,但某些 azure-identity 凭据无法正确处理此关键字参数,直到 version 1.8.0 中修复该错误。 。安装 azure-identity>=1.8.0 应该可以修复您遇到的错误。

(免责声明:我为 Azure SDK for Python 工作)

关于python - 在 Python 中访问 Azure Key Vault 时出现意外的关键字参数 'tenant_id',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72258087/

相关文章:

python - python socket.sendall 成功返回是什么意思?

javascript - 自定义 Azure DevOps REST API 调用

Azure Key Vault - 无法找到/选择前门作为访问策略的原则

azure - 将 keystore 和信任库导入到 Azure key 保管库

python - 用 `ffill`(或任何其他方法)填充 na 值,并递增 1

python - 为什么 tensorflow reshape 数组超出范围

python - 表单清理方法与模型清理方法与模型字段验证器

azure - 使用 PowerShell 锁定 Azure 资源

Azure 流分析 : Regex in Reference Data

Azure 应用程序仅访问 Key Vault key