MSAL/ADAL支持新的/旧的Azure python SDK模块



我们的应用程序从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包。

azure.identity提供了一组凭据类,用于支持Azure Active Directory(AAD(令牌身份验证的Azure SDK客户端。Mow Microsoft建议客户使用该软件包与其他Azure python SDK进行身份验证。但请注意,它并不支持所有的azure包。如果包不使用azure.core,我们使用它进行身份验证,我们将面临错误。有关更多详细信息,请参阅此处和此处。

最新更新