gpt4 book ai didi

python - Azure ResourceGraph Python 属性错误 : 'str' object has no attribute 'get'

转载 作者:行者123 更新时间:2023-12-03 05:37:50 24 4
gpt4 key购买 nike

我正在尝试使用 python lib azure.mgmt.resourcegraph 来接收租户中所有 cosmosdb 帐户的列表。

这里是代码:

from azure.mgmt.subscription import SubscriptionClient
from msrestazure.azure_active_directory import ServicePrincipalCredentials
from azure.mgmt.resourcegraph import ResourceGraphClient

credentials = ServicePrincipalCredentials(client_id, secret, tenant=tenant_id)
rgraph_object = ResourceGraphClient(credentials)

test = rgraph_object.resources(query="resources | where type == 'microsoft.documentdb/databaseaccounts'")

错误:AttributeError:“str”对象没有属性“get”

有人可以帮忙吗?

最佳答案

这个:

"resources | where type == 'microsoft.documentdb/databaseaccounts""

应该是这样的:

"resources | where type == 'microsoft.documentdb/databaseaccounts'"

关于python - Azure ResourceGraph Python 属性错误 : 'str' object has no attribute 'get' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61158803/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com