Azure Container Service Management Client Library

41.0.0 · active · verified Sun Apr 05

The `azure-mgmt-containerservice` library is the Microsoft Azure Container Service Management Client Library for Python, enabling programmatic interaction with Azure Kubernetes Service (AKS) and other container-related resources. It is currently at version 41.0.0 and frequently updated to support the latest Azure Container Service APIs, with a release cadence that includes multiple major and minor versions throughout the year. [2, 13]

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to authenticate to Azure using `DefaultAzureCredential` and instantiate the `ContainerServiceClient`. Ensure that `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`, and `AZURE_SUBSCRIPTION_ID` environment variables are set for successful authentication. [2, 6, 13]

import os
from azure.identity import DefaultAzureCredential
from azure.mgmt.containerservice import ContainerServiceClient

# Set environment variables for authentication:
# AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET
# And AZURE_SUBSCRIPTION_ID

subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "")

# Authenticate with Azure
credential = DefaultAzureCredential()

# Create a Container Service client
client = ContainerServiceClient(credential=credential, subscription_id=subscription_id)

print(f"Successfully created Azure Container Service client for subscription: {subscription_id}")

# Example: List managed clusters (actual operation not shown for brevity)
# for cluster in client.managed_clusters.list():
#     print(f"Cluster Name: {cluster.name}, Location: {cluster.location}")

view raw JSON →