python - 适用于 Python 的 Azure SDK

标签 python azure azure-sdk-python

我正在尝试使用 Python SDK 获取 Azure 租户中的订阅列表。

我想使用这个类:https://learn.microsoft.com/en-us/python/api/azure-mgmt-subscription/azure.mgmt.subscription.operations.subscriptionsoperations

list方法。

文档说“您不应该直接实例化此类,而应创建一个 Client 实例,该实例将为您创建该类并将其附加为属性。”

这是什么意思?

这就是我所拥有的:

client = SubscriptionClient(credentials)

test = SubscriptionClient.SubscriptionsOperations(client)

我得到这个:

AttributeError: type object 'SubscriptionClient' has no attribute 'SubscriptionsOperations'

谢谢

米克

最佳答案

我成功了:

client = SubscriptionClient(credentials) # correct
print (client.subscriptions)

这给了我azure.mgmt.subscription.operations.subscriptions_operations.SubscriptionsOperations,当我使用它时它会起作用。

这就是他们的意思:

“您不应直接实例化此类,而应创建一个 Client 实例,该实例将为您创建该类并将其附加为属性。”

关于python - 适用于 Python 的 Azure SDK,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58411116/

相关文章:

python - 错误?无法弄清楚

python - 将变量从 python 实时传递到 C 的最佳方法

sql - Azure 流分析查询返回 0 行

azure - AADSTS76020 : Azure AD SSO with Signin certificate cannot authenticate graph client

python - 使用 azure-mgmt-sql 从 SQL 托管实例获取数据库

azure - 使用 Python SDK 调用时如何验证 Microsoft Azure 存储帐户的身份验证

python - 是否可以从 Azure Python SDK 获取 ASC 位置?

python - 获取指针的像素位置

Python读取txt文件中的\n和\r

azure - 查询 Azure Log Analytics 中的多个表