Azure Management Groups Management Client

1.1.0 · active · verified Thu Apr 09

The `azure-mgmt-managementgroups` library provides a Microsoft Azure Management Groups Management Client for Python. It allows developers to programmatically manage Azure Management Groups, including creating, updating, deleting, and listing them. This library is part of the Azure SDK for Python, currently at version 1.1.0, and typically receives updates aligning with new Azure Management Groups API versions or SDK-wide improvements.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to authenticate with Azure using `DefaultAzureCredential` and list all existing Management Groups. This client operates at the tenant level, so it typically does not require a subscription ID.

import os
from azure.identity import DefaultAzureCredential
from azure.mgmt.managementgroups import ManagementGroupsAPI

# This client is for managing Management Groups, which exist above subscriptions.
# No subscription ID is typically needed for client instantiation.

# Authenticate using DefaultAzureCredential. It will try various methods
# like environment variables, managed identity, Azure CLI, Visual Studio Code.
credential = DefaultAzureCredential()

# Create a ManagementGroupsAPI client
client = ManagementGroupsAPI(credential)

print('Listing all Management Groups:')
for mg in client.management_groups.list():
    print(f'- ID: {mg.id}, Name: {mg.name}, Display Name: {mg.display_name}')

view raw JSON →