python - Azure Python SDK Authentication Error
问题描述
I am trying to stop a virtual machine in the azure cloud using the azure-python-sdk. I am following this page https://github.com/Azure-Samples/virtual-machines-python-manage and I have created an Azure active directory application by following this link, https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-service-principal-portal.
As a first step I am trying to authenticate using a call to ServicePrincipalCredentials passing client_id, secret, and tenant, but the connection throws the following error, 'Keyring cache token has failed: (1783, 'CredWrite', 'The stub received bad data')'
The application has a Virtual Machine Contributor permission setup. Is this a permission issue?
解决方案
Keyring 是一个可选的子系统,它完全不影响身份验证。它旨在以一种即使 Python 进程消失也可以重新实例化凭据的方式存储您的令牌,而无需再次与 AD 交谈。如果凭据有效,这不会阻止身份验证,这只是一个警告日志,如果您的 Python 进程结束,您将无法重新创建 Credentials 类而不向 AD 重新请求令牌。
如果您有一个异常堆栈跟踪明确表示这会阻止身份验证工作,请在此处打开一个问题: https ://github.com/Azure/msrestazure-for-python/issues
(我在微软拥有这段代码和库,并写了你提到的文章)
编辑:从 msrestazure 0.5.0 开始,密钥环支持已被删除。
推荐阅读
- react-native - 反应本机按钮对齐问题
- webpack - 如何在 laravel 项目之外的 laravel mix 中使用版本控制
- git - Git:拉取并使用存储库的一部分(特定目录)
- c# - DllImport("user32.dll") 在托管 IIS (Windows.Forms.SendKeys) 中不起作用
- ios - 在 Alamofire 请求中发布和获取参数
- image - 如何根据棱柱特征对图像进行分组?
- sql-server - 解密由 SQL Server 使用 AES 256 手动加密的值
- java - java.lang.ArrayIndexOutOfBoundsException:发生错误
- azure - 在 Azure Service Fabric 应用程序中存储非键值参数的位置
- linux - 为什么不推荐使用 linux 内核信号量 down() 函数?