azure储蓄计划使用python的利用率



我正在使用下面试图拉azure储蓄计划利用率数据,但我得到错误AttributeError: 'CostManagementClient'对象没有属性' benefit_utilitzation_summaries '

from azure.identity import DefaultAzureCredential
from azure.mgmt.costmanagement import CostManagementClient
from azure.identity import ClientSecretCredential
from azure.mgmt.compute import ComputeManagementClient

credential = ClientSecretCredential(
tenant_id='',
client_id= '',
client_secret= ''
)

client = CostManagementClient(
credential=credential

)

response = client.benefit_utilization_summaries.list_by_billing_account_id(
billing_account_id="",
)
for item in response:
print(item)

我引用下面的azure文档。你能告诉我我做错了什么,我怎么能改正它吗?

https://learn.microsoft.com/en-in/rest/api/cost-management/benefit-utilization-summaries/list-by-billing-account-id?tabs=Python savingsplanutilizationsummaries-billingaccount

azure-mgmt-costmanagement 3.0.0没有操作benefit_utilitzation_summaries。该操作是最近在azure-mgmt-costmanagement 4.0.0b1版本中添加的,该版本目前处于预发布状态。

你可以使用下面的命令

更新包
pip install azure-mgmt-costmanagement==4.0.0b1

最新更新