First time post. I’m very new to Python and to programming so my issue is probably between the chair and the keyboard However I cannot get the Azure BillingMangementClient class to work. When I set up an instance of the class, VSCode’s intelli sense does not pickup the methods from the class when I type the dot on the “reservation_order_ids = billing_client.” line (see code example below) and when I type them in as I think they should be I get object has no attribute ‘reservations’ or which ever name I try. See example below.
from azure.mgmt.consumption import ConsumptionManagementClient from azure.mgmt.billing import BillingManagementClient from azure.identity import DefaultAzureCredential SUBSCRIPTION_ID = #My subscription ID# command_credential = DefaultAzureCredential() billing_client = BillingManagementClient(command_credential, SUBSCRIPTION_ID) # also tried credential=command_credential, subscription_id=SUBSCRIPTION_ID in the above line reservation_order_ids = billing_client.reservations.list_by_billing_account(#my billing number here#) #I've also tried ReservationOperations and reservation_operations above in place of reservations
To compare a similar class the following works for the ConsumptionManagementClient:
consumption_client = ConsumptionManagementClient(credential=command_credential, subscription_id=SUBSCRIPTION_ID) reservation_order_ids = consumption_client.reservations_details.list(BILLING_SCOPE, FILTER)
I have version 6.0.0 of azure-mgmt-billing installed and I’m running python 3.9.1
I’ve been using the following documentation links for the above classes:
I find the documentation slightly confusing but I’m probably reading it incorrectly, for example in the above link for the consumption documentation the class that contains the list method is shown as ReservationsDetailsOperations however when it comes to coding to get the list method reservations_details needs to be used (see example in code above) which I can’t find in the docs. This makes it difficult to guess what the class is for the billing client when intelli sense/auto complete does not work.
Hope someone can help.