Azure Managed Services Management Client Library

6.0.0 · active · verified Wed Apr 15

The `azure-mgmt-managedservices` library is the Microsoft Azure Managed Services Client Library for Python, part of the Azure Resource Manager (ARM) generation of management APIs. It allows developers to programmatically interact with Azure Managed Services, such as managing registration definitions and assignments. The current stable version is 6.0.0, released in April 2021. Azure SDKs typically follow a consistent release cadence with updates across various services.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to authenticate with Azure using `DefaultAzureCredential` and then list all registration definitions within your subscription using the `ManagedServicesClient`.

import os
from azure.identity import DefaultAzureCredential
from azure.mgmt.managedservices import ManagedServicesClient

# Set your Azure Subscription ID as an environment variable
# AZURE_SUBSCRIPTION_ID = "YOUR_SUBSCRIPTION_ID"
subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "")

if not subscription_id:
    raise ValueError("AZURE_SUBSCRIPTION_ID environment variable not set.")

# Authenticate using DefaultAzureCredential. This will try various methods:
# AZURE_CLIENT_ID, AZURE_CLIENT_SECRET, AZURE_TENANT_ID environment variables, 
# Managed Identity, Azure CLI, Visual Studio Code, etc.
credential = DefaultAzureCredential()

# Create a ManagedServicesClient
client = ManagedServicesClient(credential, subscription_id)

# List registration definitions (example operation)
print("Listing registration definitions:")
for rd in client.registration_definitions.list():
    print(f"  - {rd.id}: {rd.name}")

view raw JSON →