{"id":1357,"library":"azure-mgmt-billing","title":"Microsoft Azure Billing Client Library for Python","description":"The azure-mgmt-billing library is the Microsoft Azure Billing Client Library for Python. It provides an interface for managing Azure billing resources. As part of the wider Azure SDK for Python, it adheres to modern SDK guidelines and receives regular updates to support new Azure features and improvements. The current stable version is 7.0.0.","status":"active","version":"7.0.0","language":"en","source_language":"en","source_url":"https://github.com/Azure/azure-sdk-for-python","tags":["azure","billing","cloud","management","sdk"],"install":[{"cmd":"pip install azure-mgmt-billing azure-identity","lang":"bash","label":"Install stable version with identity"}],"dependencies":[{"reason":"Required for authentication using Azure Active Directory credentials.","package":"azure-identity","optional":false}],"imports":[{"symbol":"BillingManagementClient","correct":"from azure.mgmt.billing import BillingManagementClient"},{"symbol":"DefaultAzureCredential","correct":"from azure.identity import DefaultAzureCredential"}],"quickstart":{"code":"import os\nfrom azure.identity import DefaultAzureCredential\nfrom azure.mgmt.billing import BillingManagementClient\n\n# Set these environment variables for authentication\n# AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET\n# AZURE_SUBSCRIPTION_ID (for billing operations)\n\nsubscription_id = os.environ.get('AZURE_SUBSCRIPTION_ID', 'YOUR_SUBSCRIPTION_ID')\n\n# Authenticate using DefaultAzureCredential\ncredential = DefaultAzureCredential()\n\n# Create a BillingManagementClient\nbilling_client = BillingManagementClient(credential=credential, subscription_id=subscription_id)\n\n# Example: List billing accounts (this operation might not require subscription_id directly, \n# but the client is often initialized with it for consistency across management clients)\n# Replace with an actual operation relevant to your billing scenario\n# For example: print(list(billing_client.billing_accounts.list()))\nprint('BillingManagementClient initialized successfully.')\n","lang":"python","description":"Initializes the BillingManagementClient using DefaultAzureCredential for authentication. This requires Azure Active Directory environment variables (AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET) and AZURE_SUBSCRIPTION_ID to be set. It then demonstrates how to create a client instance."},"warnings":[{"fix":"Refer to the official SDK documentation for 7.0.0 to update usage patterns and model properties. Re-evaluate calls to affected operation groups and model attributes.","message":"Version 7.0.0 introduced significant breaking changes, including the deletion or renaming of client operation groups such as 'BillingManagementClient.instructions', 'BillingManagementClient.billing_role_definitions', and 'BillingManagementClient.billing_periods'. Additionally, the 'Agreement' model had its 'agreement_link', 'category', 'acceptance_mode', and 'effective_date' instance variables deleted or renamed.","severity":"breaking","affected_versions":"7.0.0 and higher"},{"fix":"Migrate authentication to `azure-identity.DefaultAzureCredential`. Update client instantiation to pass configuration as keyword arguments. Add the `begin_` prefix to LRO method calls and handle the `LROPoller` return type.","message":"The Azure SDK for Python underwent a major regeneration around version 6.0.0. This change revamped the credential system (deprecating `azure.common.credentials` and `msrestazure.azure_active_directory` in favor of `azure-identity`), renamed the `credentials` parameter to `credential`, removed the `config` attribute from clients, and introduced the `begin_` prefix for long-running asynchronous operations (LROs).","severity":"breaking","affected_versions":"6.0.0 and higher (from older versions)"},{"fix":"Upgrade your Python environment to Python 3.8 or higher. The current version of azure-mgmt-billing requires Python 3.8+.","message":"Support for Python 2.7 in Azure SDK Python packages officially ended on January 1, 2022. Using this library with Python 2.7 is unsupported and may lead to security vulnerabilities or unexpected behavior.","severity":"deprecated","affected_versions":"<= 5.x.x"},{"fix":"When calling a method prefixed with `begin_`, remember that it returns a poller. You must call `.result()` on the poller to wait for the operation to complete and get its final result (e.g., `resource = client.resource_groups.begin_create_or_update(...).result()`).","message":"Many resource management operations in the Azure SDK for Python (especially those involving creating, updating, or deleting resources) are asynchronous and return an `LROPoller` object. These methods are typically prefixed with `begin_`.","severity":"gotcha","affected_versions":"6.0.0 and higher"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}