【发布时间】:2020-12-21 10:15:04
【问题描述】:
我们的应用程序从使用 Azure python SDK 2.0.0 的 ADAL 身份验证开始。
现在我开始将azure.mgmt.servicebus 升级到 6.0.0,在使用 ADAL 凭据时发现异常。
creatednamespace = servicebus_client.namespaces.begin_create_or_update(resource_group_name, namespace_name, namespaceparameter).result()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.6/dist-packages/azure/mgmt/servicebus/operations/_namespaces_operations.py", line 563, in begin_create_or_update
**kwargs
File "/usr/local/lib/python3.6/dist-packages/azure/mgmt/servicebus/operations/_namespaces_operations.py", line 502, in _create_or_update_initial
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/azure/core/pipeline/_base.py", line 211, in run
return first_node.send(pipeline_request) # type: ignore
File "/usr/local/lib/python3.6/dist-packages/azure/core/pipeline/_base.py", line 71, in send
response = self.next.send(request)
File "/usr/local/lib/python3.6/dist-packages/azure/mgmt/core/policies/_base.py", line 47, in send
response = self.next.send(request)
File "/usr/local/lib/python3.6/dist-packages/azure/core/pipeline/_base.py", line 71, in send
response = self.next.send(request)
File "/usr/local/lib/python3.6/dist-packages/azure/core/pipeline/_base.py", line 71, in send
response = self.next.send(request)
File "/usr/local/lib/python3.6/dist-packages/azure/core/pipeline/_base.py", line 71, in send
response = self.next.send(request)
[Previous line repeated 1 more time]
File "/usr/local/lib/python3.6/dist-packages/azure/core/pipeline/policies/_redirect.py", line 157, in send
response = self.next.send(request)
File "/usr/local/lib/python3.6/dist-packages/azure/core/pipeline/policies/_retry.py", line 436, in send
response = self.next.send(request)
File "/usr/local/lib/python3.6/dist-packages/azure/core/pipeline/_base.py", line 69, in send
_await_result(self._policy.on_request, request)
File "/usr/local/lib/python3.6/dist-packages/azure/core/pipeline/_tools.py", line 29, in await_result
result = func(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/azure/core/pipeline/policies/_authentication.py", line 93, in on_request
self._token = self._credential.get_token(*self._scopes)
我阅读了 Azure 文档,新功能将需要 MSAL 或 azure.identity,我使用了 azure.identy,它确实有效。 现在的问题是我们混合了新旧 Azure SDK 包,我们应该遵循哪种身份验证?我尝试了带有 azure.identity 的旧包,它似乎仍然有效。但我不确定是否有任何我可能不知道的问题。 希望我们能得到一份清晰的 Azure 身份验证指南,以支持新旧 python SDK 包。
【问题讨论】: