小编Var*_*run的帖子

列出给定 Azure 帐户的订阅

我正在尝试使用azure-python-sdk列出 Azure 帐户中的订阅。

我已点击文档中的此链接。

https://learn.microsoft.com/en-us/python/api/azure-mgmt-subscription/azure.mgmt.subscription.operations.subscriptionsoperations?view=azure-python#list-custom-headers-none--raw -false----操作配置-


from azure.mgmt.subscription import SubscriptionClient
from msrestazure.azure_active_directory import UserPassCredentials

credentials = UserPassCredentials(username='xxxx', password='xxxx')
sub_client = SubscriptionClient(credentials)
subs = [sub.as_dict() for sub in sub_client.subscriptions.list()]
print(subs)

Run Code Online (Sandbox Code Playgroud)

它应该返回订阅列表。但是,每次尝试上述代码时,我都只看到返回空列表。有人可以帮忙吗?

python azure azure-sdk-python

8
推荐指数
1
解决办法
1万
查看次数

标签 统计

azure ×1

azure-sdk-python ×1

python ×1