Registry / azure / azure-servicefabric

azure-servicefabric

JSON →
library8.2.0.0pypypi✓ verified 23d ago

The `azure-servicefabric` library provides a client for programmatically interacting directly with Microsoft Azure Service Fabric clusters using Python. It allows for management of applications, services, nodes, and other cluster resources. This library is part of the older Azure SDK for Python (Track 1) and was last updated in April 2021. It is currently in maintenance mode, receiving critical bug fixes but not active feature development.

pip install azure-servicefabric
INSTALL
IMPORT
SIG · AZURE-SERVICEFABRI
A
azure-servicefabric
azurepythonv8.2.0.0
Install
2.9s avg
Import
Disk
30MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v8.2.0.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.000s · 31.3MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.9s · import 0.000s · 32MB
30MB installed
● package 30MB
Code
Verified usage

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

ServiceFabricClient
from azure.servicefabric import ServiceFabricClient
from azure.servicefabric.service_fabric_client import ServiceFabricClient

This quickstart demonstrates how to initialize the `ServiceFabricClient` and connect to a secure Service Fabric cluster using client certificates, then list the nodes. Ensure you have the cluster endpoint, client certificate (.pem) and private key (.key) files accessible and their paths set in environment variables.

import os from azure.servicefabric import ServiceFabricClient from msrest.service_fabric import ServiceFabricCredential # Connect to a secure Service Fabric cluster using client certificates # Replace with your cluster endpoint and certificate paths cluster_endpoint = os.environ.get('SF_CLUSTER_ENDPOINT', 'https://your_cluster_fqdn:19080') cert_file = os.environ.get('SF_CLIENT_CERT_FILE', 'path/to/your/client.pem') key_file = os.environ.get('SF_CLIENT_KEY_FILE', 'path/to/your/client.key') # or .pfx if combined if not all([cluster_endpoint, cert_file, key_file]): print("Please set SF_CLUSTER_ENDPOINT, SF_CLIENT_CERT_FILE, and SF_CLIENT_KEY_FILE environment variables.") print("Example: export SF_CLUSTER_ENDPOINT='https://mycluster.westus.cloudapp.azure.com:19080'") print("Example: export SF_CLIENT_CERT_FILE='/etc/sf/client.pem'") print("Example: export SF_CLIENT_KEY_FILE='/etc/sf/client.key'") else: try: # Service Fabric client expects a tuple of (cert_file, key_file) for ServiceFabricCredential credentials = ServiceFabricCredential((cert_file, key_file)) client = ServiceFabricClient(base_url=cluster_endpoint, credentials=credentials) print(f"Connecting to Service Fabric cluster at: {cluster_endpoint}") # Example: List all nodes in the cluster nodes = client.nodes.get_node_list() print(f"Found {len(nodes)} nodes in the cluster:") for node in nodes: print(f"- Node Name: {node.name}, Status: {node.health_state}, Type: {node.type}") except Exception as e: print(f"An error occurred: {e}") print("Ensure the certificate paths are correct and the cluster endpoint is reachable.")
Debug
Known issues
gotchaThis library is part of the older Azure SDK Track 1. It does not use the newer `azure-identity` credential types. Authentication typically requires `msrest.service_fabric.ServiceFabricCredential` which supports certificate-based authentication. This can be complex to configure correctly.
fix
Refer to the `msrest` and `azure-servicefabric` documentation for `ServiceFabricCredential` and certificate setup. Ensure certificates are in the correct format (e.g., .pem, .key).
affects: All versions
deprecatedThe `azure-servicefabric` library is in maintenance mode and was last updated in April 2021. For managing Service Fabric clusters via Azure Resource Manager (ARM), consider using `azure-mgmt-servicefabric` which is part of the newer Azure SDK Track 2 and actively maintained.
fix
For direct cluster API interactions, `azure-servicefabric` is still functional. For ARM-level management (creating/updating clusters), use `pip install azure-mgmt-servicefabric` and the newer client. Differentiate between cluster management plane (ARM) and cluster runtime interactions (this library).
affects: <=8.2.0.0
gotchaUnlike newer Azure SDK libraries that often use `Async` variants, `azure-servicefabric` is synchronous. All client operations will block until the call completes.
fix
Design your application to handle synchronous I/O or wrap calls in a separate thread/process if non-blocking behavior is required.
affects: All versions
Upgrade
Version history
8.2.0.0latest on PyPI · released Dec 14, 2021
Audit
Dependencies
msrestrequiredCore dependency for service client and data models in older Azure SDKs.
msrestazurerequiredAzure-specific extensions for `msrest`, often for authentication and models.
Agent activity
26 hits · last 30 days
node
22
OpenAI (training)
1
Resources
azure-servicefabric — pip install azure-servicefabric · libregistry