Registry /
azure / azure-mgmt-reservations
Install & Compatibility
Where this runs
tested against v3.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
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.088s · 44.5MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 3.9s · import 0.090s · 45MB
44MB installed
● package 44MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
AzureReservationAPI
✓ from azure.mgmt.reservations import AzureReservationAPI
✗ from azure.mgmt.reservations.azure_reservation_api import AzureReservationAPI
As of v0.4.0 and later, top-level client imports moved to the package root.
DefaultAzureCredential
✓ from azure.identity import DefaultAzureCredential
This quickstart demonstrates how to authenticate with `DefaultAzureCredential` and list Azure Reservation Orders using the `azure-mgmt-reservations` library. Ensure `AZURE_SUBSCRIPTION_ID` and other necessary Azure AD environment variables (e.g., `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`) are set for `DefaultAzureCredential` to function correctly.
import os
from azure.identity import DefaultAzureCredential
from azure.mgmt.reservations import AzureReservationAPI
# Set these environment variables or replace with your actual values for a production setup
# AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET for DefaultAzureCredential (Service Principal)
# AZURE_SUBSCRIPTION_ID for the Reservations client
subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "your_subscription_id_here")
# Authenticate using DefaultAzureCredential
# This credential type tries various authentication methods, like environment variables,
# managed identity, or Azure CLI login.
credential = DefaultAzureCredential()
# Create a Reservations Management client
client = AzureReservationAPI(credential=credential, subscription_id=subscription_id)
# List all reservation orders
print("Listing reservation orders:")
for order in client.reservation_order.list():
print(f" Order ID: {order.id}, Display Name: {order.display_name}, Status: {order.provisioning_state}")
# You can also list reservations within an order, for example:
# if client.reservation_order.list():
# first_order_id = client.reservation_order.list().next().name # Assuming at least one order exists
# print(f"\nListing reservations for order {first_order_id}:")
# for reservation in client.reservation.list(reservation_order_id=first_order_id):
# print(f" Reservation ID: {reservation.id}, Scope: {reservation.scope}, Quantity: {reservation.quantity}")
Debug
Known issues
breakingThe credential system was completely revamped in versions around 1.0.0b1/1.0.0, moving away from `azure.common.credentials` or `msrestazure.azure_active_directory`. Use `azure-identity` classes (e.g., `DefaultAzureCredential`) instead. The client constructor's `credentials` parameter was renamed to `credential`.fixUpdate authentication logic to use `azure-identity` and replace `credentials` keyword argument with `credential`.
affects: <1.0.0
breakingStarting with versions around 1.0.0, operations returning a long-running poller now return `azure.core.polling.LROPoller` instead of `msrest.polling.LROPoller` and are typically prefixed with `begin_`. Additionally, `CloudError` was removed, and most exceptions are now `azure.core.exceptions.HttpResponseError`.fixAdjust code to use `begin_` prefixed methods for LROs and handle `azure.core.exceptions.HttpResponseError` for general API errors.
affects: <1.0.0
breakingImport paths for client classes and models changed, particularly around v0.4.0. Importing `AzureReservationAPI` or models from submodules (e.g., `azure.mgmt.reservations.azure_reservation_api` or `azure.mgmt.reservations.models.my_class`) is no longer supported; they should be imported directly from the `azure.mgmt.reservations` or `azure.mgmt.reservations.models` package respectively.fixUpdate import statements to directly import client and model classes from their top-level package or `models` submodule (e.g., `from azure.mgmt.reservations import AzureReservationAPI`).
affects: <0.4.0
gotchaAuthentication with `DefaultAzureCredential` relies on specific environment variables (`AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`) for service principal authentication, and `AZURE_SUBSCRIPTION_ID` is crucial for client instantiation. Misconfiguration is a common source of authentication errors.fixEnsure environment variables `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`, and `AZURE_SUBSCRIPTION_ID` are correctly set, or explicitly pass credentials/subscription ID in a production environment.
affects: All versions >=1.0.0
gotchaPermissions for managing Azure Reservations are distinct and do not inherit from Azure subscription permissions. Users need specific Reservation RBAC roles (e.g., Reservations Administrator, Contributor, Reader) or relevant Billing Admin roles to view and manage reservations.fixVerify that the authenticated identity (user or service principal) has the necessary Reservation-specific RBAC roles or Billing Admin roles applied at the correct scope to perform the desired operations.
affects: All versions
gotchaPython 2.7 support for Azure SDK Python packages, including `azure-mgmt-reservations`, officially ended on January 1, 2022. The library now requires Python 3.7+.fixEnsure your development and deployment environments are running Python 3.7 or a newer compatible version.
affects: All versions >=1.0.0
Upgrade
Version history
3.0.0latest on PyPI · released Jul 30, 2026
Audit
Dependencies
azure-identityrequiredRequired for Azure Active Directory token authentication with DefaultAzureCredential or other credential types.
azure-corerequiredCore shared components for Azure SDK client libraries. Implicitly installed.