Azure Service Fabric Managed Clusters Management Client Library for Python
The `azure-mgmt-servicefabricmanagedclusters` library is the Microsoft Azure Service Fabric Managed Clusters Management Client Library for Python. It simplifies the deployment and management of Service Fabric managed clusters, which encapsulate underlying resources into a single Azure Resource Manager resource. This library is actively maintained and currently at version 3.0.0, supporting Python 3.9 and newer.
Warnings
- breaking The `sku` parameter of the `ManagedCluster` model became required in version 2.0.0. If you are upgrading from a version older than 2.0.0, ensure this parameter is always provided when creating or updating managed clusters.
- breaking Operations `ManagedClusterVersionOperations.get_by_environment` and `ManagedClusterVersionOperations.list_by_environment` gained a new required `environment` parameter in version 2.0.0. Calls to these methods without the `environment` parameter will break.
- gotcha There is no in-place migration path from existing (traditional) Azure Service Fabric clusters to Service Fabric Managed Clusters. You must create a new managed cluster resource.
- gotcha Manual changes to the underlying resources of a Service Fabric managed cluster (e.g., Virtual Machine Scale Sets, Load Balancers) are not supported. Managed clusters are fully encapsulated, and Azure manages these resources on your behalf.
- gotcha This library requires Python 3.9 or newer. Using older Python versions will result in compatibility issues.
Install
-
pip install azure-mgmt-servicefabricmanagedclusters azure-identity
Imports
- ServiceFabricManagedClustersManagementClient
from azure.mgmt.servicefabricmanagedclusters import ServiceFabricManagedClustersManagementClient
- DefaultAzureCredential
from azure.identity import DefaultAzureCredential
Quickstart
import os
from azure.identity import DefaultAzureCredential
from azure.mgmt.servicefabricmanagedclusters import ServiceFabricManagedClustersManagementClient
# 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", "")
if not subscription_id:
raise ValueError("AZURE_SUBSCRIPTION_ID environment variable not set.")
# Authenticate using DefaultAzureCredential
credential = DefaultAzureCredential()
# Create a Service Fabric Managed Clusters Management Client
client = ServiceFabricManagedClustersManagementClient(credential, subscription_id)
# Example: List all managed clusters in the subscription
print("Listing Service Fabric Managed Clusters...")
for cluster in client.managed_clusters.list_by_subscription():
print(f"- {cluster.name} (Resource Group: {cluster.resource_group})")