Registry / azure / azure-mgmt-servicefabric

azure-mgmt-servicefabric

JSON →
library2.1.0pypypi✓ verified 25d ago

The `azure-mgmt-servicefabric` library is the Microsoft Azure Service Fabric Management Client Library for Python. It allows developers to programmatically manage Azure Service Fabric resources, such as clusters, applications, and services. The current stable version is 2.1.0, released on December 18, 2023. As part of the broader Azure SDK for Python, it follows a frequent release cadence, with updates often aligning with new features and fixes across Azure services.

pip install azure-mgmt-servicefabric azure-identity
INSTALL
IMPORT
SIG · AZURE-MGMT-SERVICE
A
azure-mgmt-servicefabric
azurepythonv2.1.0
Install
3.9s avg
Import
596ms
Disk
44MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.1.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
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.612s · 44.7MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 3.9s · import 0.580s · 45MB
44MB installed
● package 44MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ServiceFabricManagementClient
from azure.mgmt.servicefabric import ServiceFabricManagementClient
from azure.mgmt.servicefabric.service_fabric_management_client import ServiceFabricManagementClient
Prior to version 1.0.0b1, the client could be imported directly from its submodule. Post-1.0.0b1, the client should be imported directly from the top-level package.
DefaultAzureCredential
from azure.identity import DefaultAzureCredential

This quickstart demonstrates how to authenticate with Azure using `DefaultAzureCredential` and instantiate the `ServiceFabricManagementClient`. It then shows how to list Service Fabric clusters within a specified resource group. Ensure relevant Azure environment variables for authentication and subscription ID are set.

import os from azure.identity import DefaultAzureCredential from azure.mgmt.servicefabric import ServiceFabricManagementClient # Ensure these environment variables are set: # AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET (for DefaultAzureCredential) # AZURE_SUBSCRIPTION_ID # AZURE_RESOURCE_GROUP_NAME (for listing clusters) subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "<your-subscription-id>") resource_group_name = os.environ.get("AZURE_RESOURCE_GROUP_NAME", "<your-resource-group>") try: # Authenticate using DefaultAzureCredential # This credential will attempt to authenticate in various ways, including # environment variables, managed identity, and Azure CLI login. credential = DefaultAzureCredential() # Create a Service Fabric Management client client = ServiceFabricManagementClient(credential=credential, subscription_id=subscription_id) # Example: List all Service Fabric clusters in a specified resource group print(f"Listing Service Fabric clusters in resource group: {resource_group_name}...") clusters = client.clusters.list_by_resource_group(resource_group_name) for cluster in clusters: print(f" - Cluster Name: {cluster.name}, Location: {cluster.location}, Resource ID: {cluster.id}") except Exception as e: print(f"An error occurred: {e}") print("Please ensure your Azure environment variables (AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET, AZURE_SUBSCRIPTION_ID, AZURE_RESOURCE_GROUP_NAME) are correctly set and your service principal has the necessary permissions.")
Debug
Known issues
breakingMajor breaking changes occurred around version 1.0.0b1 (before 2.0.0) with the transition to the 'Track 2' Azure SDK guidelines. Authentication methods using `azure.common.credentials` or `msrestazure.azure_active_directory` are no longer supported. The `credentials` parameter for client constructors was renamed to `credential`.
fix
Migrate authentication to use classes from `azure-identity` (e.g., `DefaultAzureCredential`) and update client instantiation to use the `credential` parameter. Review the migration guide for the Azure SDK for Python if upgrading from very old versions.
affects: >=1.0.0b1
breakingDirect imports from specific submodules like `azure.mgmt.servicefabric.service_fabric_management_client` for client classes, and `azure.mgmt.servicefabric.models.my_class` for models, were changed. Imports should now typically be from the top-level package or `azure.mgmt.servicefabric.models` for models.
fix
Update import statements to `from azure.mgmt.servicefabric import ServiceFabricManagementClient` and `from azure.mgmt.servicefabric.models import MyClass`.
affects: >=1.0.0b1
deprecatedSupport for Python 2.7 in Azure SDK Python packages ended on January 1, 2022. Using `azure-mgmt-servicefabric` with Python 2.7 is unsupported and may lead to unpatched security vulnerabilities or functional issues.
fix
Upgrade to Python 3.7 or higher. The current version requires Python >=3.7.
affects: <=2.1.0
gotchaAzure Service Fabric has two deployment models: 'classic' clusters and 'managed' clusters. This library (`azure-mgmt-servicefabric`) is for managing 'classic' Service Fabric clusters. For Service Fabric *managed* clusters, use the `azure-mgmt-servicefabricmanagedclusters` library, which provides a simplified cluster management experience.
fix
Ensure you are using the correct management library based on your Service Fabric cluster type. If managing Service Fabric Managed Clusters, install and use `azure-mgmt-servicefabricmanagedclusters`.
affects: All
gotchaFor production Service Fabric clusters, it is critical to configure Silver or Gold durability tiers. Azure Service Fabric blocks deployments that do not meet Silver or Gold durability requirements to prevent data loss during underlying VM infrastructure operations, especially for production workloads.
fix
When deploying or configuring Service Fabric clusters, ensure that the durability tier is set to Silver or Gold for production environments. This often implies a minimum number of VMs (e.g., 5 or more for Silver/Gold).
affects: All
gotchaThe `DefaultAzureCredential` from `azure-identity` requires proper configuration of the environment (e.g., environment variables, Azure CLI login, Managed Identity availability) to successfully authenticate. If no credentials are found or configured, authentication will fail with a 'DefaultAzureCredential failed to retrieve a token' error.
fix
Ensure your environment is correctly configured for `DefaultAzureCredential`. This typically involves setting `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, and `AZURE_CLIENT_SECRET` (or `AZURE_CLIENT_CERTIFICATE_PATH`) environment variables for a service principal, or logging in via Azure CLI (`az login`), or ensuring a Managed Identity is available when running in Azure hosting environments. For detailed troubleshooting, refer to the `azure-identity` documentation (https://aka.ms/azsdk/python/identity/defaultazurecredential/troubleshoot).
affects: All
gotchaDefaultAzureCredential failed to authenticate. This usually indicates that necessary environment variables (e.g., `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`, `AZURE_SUBSCRIPTION_ID`) are not set, or other credential sources (like Azure CLI, Managed Identity, Workload Identity) are not configured or available in the execution environment. Review the detailed error messages for specific credential failures reported by DefaultAzureCredential.
fix
Ensure the required Azure environment variables are correctly set for your chosen authentication method (e.g., service principal credentials). For local development, consider authenticating via `az login` (Azure CLI) or configuring Visual Studio Code. Refer to the Azure Identity documentation for Python for detailed setup and troubleshooting: `https://aka.ms/azsdk/python/identity/defaultazurecredential/troubleshoot`.
affects: All
Upgrade
Version history
2.1.0latest on PyPI · released Dec 18, 2023
Audit
Dependencies
azure-identityrequiredRequired for modern Azure Active Directory authentication.
Agent activity
30 hits · last 30 days
node
24
OpenAI (training)
1
Resources
azure-mgmt-servicefabric — pip install azure-mgmt-servicefabric · libregistry