I am using below trying to pull azure savings plan utilization data but I am getting error AttributeError: 'CostManagementClient' object has no attribute 'benefit_utilization_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)
I am referring below azure documentation. can you guide me how what i am doing wrong and how can i fix it.
CodePudding user response:
azure-mgmt-costmanagement 3.0.0 doesn't have the operation benefit_utilization_summaries . This operation is recently added in the version azure-mgmt-costmanagement 4.0.0b1 which is currently in pre-release state.
You can update the package using below command
pip install azure-mgmt-costmanagement==4.0.0b1