Registry /
azure / azure-mgmt-containerservice
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]
Install & Compatibility
Where this runs
tested against v41.3.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.930 runs
installs and imports cleanly · install 0.0s · import 0.687s · 45MB
glibcpy 3.10–3.930 runs
installs and imports cleanly · install 3.8s · import 0.616s · 45MB
44MB installed
● package 44MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
ContainerServiceClient
✓ from azure.mgmt.containerservice import ContainerServiceClient
DefaultAzureCredential
✓ from azure.identity import DefaultAzureCredential
✗ from azure.common.credentials import ServicePrincipalCredentials
Older Azure SDK libraries used `azure.common.credentials` which is now deprecated. The `azure-identity` library provides modern token-based authentication. [1, 6, 18]
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}")
Debug
Known issues
breakingVersion 41.0.0 and newer packages now exclusively target the latest API-Version available on Azure, removing APIs from older versions. Applications relying on specific, non-latest API versions must pin the package to a previous release. [2, 3]fixIf your application requires a specific older API version, pin `azure-mgmt-containerservice` to a version prior to 41.0.0 (e.g., `<41.0.0`). Otherwise, update your code to use the latest API models and operations. [2]
affects: >=41.0.0
breakingThe client operation group `ContainerServiceClient.container_service` has been deleted or renamed in version 41.0.0. [2]fixReview the latest API documentation for `ContainerServiceClient` to identify the correct client operation group and method names for your specific use case. [2, 9]
affects: >=41.0.0
deprecatedOlder Azure SDK authentication methods, such as those using `azure.common.credentials`, are deprecated. The `azure-identity` library should be used for modern token-based authentication. [1, 6, 18]fixMigrate your authentication code to use `azure-identity` and `DefaultAzureCredential` as shown in the quickstart. [1, 6]
affects: <4.0.0 (and general older SDKs)
gotchaPython 2.7 support for Azure SDK Python packages ended on January 1, 2022. This package requires Python 3.9+. [2, 13]fixEnsure your development and deployment environments use Python 3.9 or a newer supported version. [2, 13]
affects: <3.9
Audit
Dependencies
azure-identityrequiredRequired for Azure Active Directory token-based authentication across the Azure SDK. [1, 2, 6]