Registry / azure / azure-mgmt-billing

azure-mgmt-billing

JSON →
library8.0.0pypypi✓ verified 25d ago

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.

pip install azure-mgmt-billing azure-identity
INSTALL
IMPORT
SIG · AZURE-MGMT-BILLING
A
azure-mgmt-billing
azurepythonv8.0.0
Install
4.0s avg
Import
692ms
Disk
48MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v8.0.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.740s · 48.2MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 4.0s · import 0.644s · 49MB
48MB installed
● package 48MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

BillingManagementClient
from azure.mgmt.billing import BillingManagementClient
DefaultAzureCredential
from azure.identity import DefaultAzureCredential

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.

import os from azure.identity import DefaultAzureCredential from azure.mgmt.billing import BillingManagementClient # Set these environment variables for authentication # AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET # AZURE_SUBSCRIPTION_ID (for billing operations) subscription_id = os.environ.get('AZURE_SUBSCRIPTION_ID', 'YOUR_SUBSCRIPTION_ID') # Authenticate using DefaultAzureCredential credential = DefaultAzureCredential() # Create a BillingManagementClient billing_client = BillingManagementClient(credential=credential, subscription_id=subscription_id) # Example: List billing accounts (this operation might not require subscription_id directly, # but the client is often initialized with it for consistency across management clients) # Replace with an actual operation relevant to your billing scenario # For example: print(list(billing_client.billing_accounts.list())) print('BillingManagementClient initialized successfully.')
Debug
Known issues
breakingVersion 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.
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.
affects: 7.0.0 and higher
breakingThe 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).
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.
affects: 6.0.0 and higher (from older versions)
deprecatedSupport 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.
fix
Upgrade your Python environment to Python 3.8 or higher. The current version of azure-mgmt-billing requires Python 3.8+.
affects: <= 5.x.x
gotchaMany 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_`.
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()`).
affects: 6.0.0 and higher
Upgrade
Version history
8.0.0latest on PyPI · released Jun 24, 2026
Audit
Dependencies
azure-identityrequiredRequired for authentication using Azure Active Directory credentials.
Agent activity
28 hits · last 30 days
node
20
OpenAI (training)
1
Resources
azure-mgmt-billing — pip install azure-mgmt-billing · libregistry