Azure Subscriptions Management Client

1.0.0b1 · active · verified Thu Apr 16

The `azure-mgmt-resource-subscriptions` library is the Microsoft Azure Resource Subscriptions Management Client Library for Python. It provides functionality to manage Azure subscriptions programmatically. As of the current release, 1.0.0b1, it is in a beta stage, indicating active development with potential for non-backward compatible changes. It is part of the broader Azure SDK for Python ecosystem, which typically follows a frequent release cadence for both stable and preview packages.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to authenticate using `DefaultAzureCredential` and list all accessible Azure subscriptions. Ensure the necessary environment variables (`AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`) are configured for `DefaultAzureCredential` to function, or use other authentication methods provided by `azure-identity`.

import os
from azure.identity import DefaultAzureCredential
from azure.mgmt.resource.subscriptions import SubscriptionClient

# Ensure environment variables are set for authentication:
# AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET
# (or other methods supported by DefaultAzureCredential)

credential = DefaultAzureCredential()
client = SubscriptionClient(credential=credential)

print("Listing Azure subscriptions:")
for subscription in client.subscriptions.list():
    print(f"  Name: {subscription.display_name} (ID: {subscription.subscription_id})")

view raw JSON →