Microsoft Azure Recovery Services Backup Management Client Library for Python
—
Quality
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Core client initialization and configuration for both ActiveStamp and PassiveStamp APIs. The Azure Recovery Services Backup library provides separate clients optimized for different backup scenarios and operational patterns.
Primary client for comprehensive backup management operations including policy management, protection configuration, backup execution, and standard restore operations.
class RecoveryServicesBackupClient:
def __init__(
self,
credential: TokenCredential,
subscription_id: str,
base_url: str = "https://management.azure.com",
**kwargs
):
"""
Initialize the ActiveStamp backup client.
Parameters:
- credential: Azure credential for authentication
- subscription_id: Azure subscription ID
- base_url: Azure management endpoint URL
- kwargs: Additional client configuration options
"""
# Primary operation groups (43 total)
backup_engines: BackupEnginesOperations
backup_jobs: BackupJobsOperations
backup_operation_results: BackupOperationResultsOperations
backup_operation_statuses: BackupOperationStatusesOperations
backup_policies: BackupPoliciesOperations
backup_protectable_items: BackupProtectableItemsOperations
backup_protected_items: BackupProtectedItemsOperations
backup_protection_containers: BackupProtectionContainersOperations
backup_protection_intent: BackupProtectionIntentOperations
backup_resource_encryption_configs: BackupResourceEncryptionConfigsOperations
backup_resource_storage_configs_non_crr: BackupResourceStorageConfigsNonCRROperations
backup_resource_vault_configs: BackupResourceVaultConfigsOperations
backup_status: BackupStatusOperations
backup_usage_summaries: BackupUsageSummariesOperations
backup_workload_items: BackupWorkloadItemsOperations
backups: BackupsOperations
backup_resource_storage_configs: BackupResourceStorageConfigsOperations
cross_region_restore: CrossRegionRestoreOperations
deleted_protection_containers: DeletedProtectionContainersOperations
export_jobs_operation_results: ExportJobsOperationResultsOperations
feature_support: FeatureSupportOperations
item_level_recovery_connections: ItemLevelRecoveryConnectionsOperations
job_cancellations: JobCancellationsOperations
job_details: JobDetailsOperations
job_operation_results: JobOperationResultsOperations
jobs: JobsOperations
operations: OperationsOperations
private_endpoint_connection: PrivateEndpointConnectionOperations
private_endpoint: PrivateEndpointOperations
protected_item_operation_results: ProtectedItemOperationResultsOperations
protected_item_operation_statuses: ProtectedItemOperationStatusesOperations
protected_items: ProtectedItemsOperations
protection_container_operation_results: ProtectionContainerOperationResultsOperations
protection_container_refresh_operation_results: ProtectionContainerRefreshOperationResultsOperations
protection_containers: ProtectionContainersOperations
protection_intent: ProtectionIntentOperations
protection_policies: ProtectionPoliciesOperations
protection_policy_operation_results: ProtectionPolicyOperationResultsOperations
protection_policy_operation_statuses: ProtectionPolicyOperationStatusesOperations
recovery_points: RecoveryPointsOperations
restores: RestoresOperations
security_pins: SecurityPINsOperations
soft_deleted_containers: SoftDeletedContainersOperations
validate_operation: ValidateOperationOperations
validate_operation_results: ValidateOperationResultsOperations
validate_operation_statuses: ValidateOperationStatusesOperations
def close(self) -> None:
"""Close the client and release resources."""Usage example:
import os
from azure.identity import DefaultAzureCredential
from azure.mgmt.recoveryservicesbackup.activestamp import RecoveryServicesBackupClient
# Create client with default authentication
credential = DefaultAzureCredential()
subscription_id = os.getenv("AZURE_SUBSCRIPTION_ID")
client = RecoveryServicesBackupClient(
credential=credential,
subscription_id=subscription_id
)
# Use the client for backup operations
policies = client.backup_policies.list("my-rg", "my-vault")Specialized client for Cross-Region Restore (CRR) operations, optimized for disaster recovery scenarios and cross-region backup management.
class RecoveryServicesBackupPassiveClient:
def __init__(
self,
credential: TokenCredential,
subscription_id: str,
base_url: str = "https://management.azure.com",
**kwargs
):
"""
Initialize the PassiveStamp backup client for CRR operations.
Parameters:
- credential: Azure credential for authentication
- subscription_id: Azure subscription ID
- base_url: Azure management endpoint URL
- kwargs: Additional client configuration options
"""
# CRR-specific operation groups (11 total)
backup_crr_job_details: BackupCrrJobDetailsOperations
backup_crr_jobs: BackupCrrJobsOperations
backup_crr_operation_results: BackupCrrOperationResultsOperations
crr_operation_status: CrrOperationStatusOperations
cross_region_restore: CrossRegionRestoreOperations
recovery_points: RecoveryPointsOperations
recovery_points_get: RecoveryPointsGetOperations
recovery_points_crr: RecoveryPointsCrrOperations
restores: RestoresOperations
validate_operations: ValidateOperationsOperations
def close(self) -> None:
"""Close the client and release resources."""Usage example:
from azure.mgmt.recoveryservicesbackup.passivestamp import RecoveryServicesBackupPassiveClient
# Create CRR client
crr_client = RecoveryServicesBackupPassiveClient(
credential=credential,
subscription_id=subscription_id
)
# Use for cross-region restore operations
crr_jobs = crr_client.backup_crr_jobs.list("eastus", "my-rg", "my-vault")Both ActiveStamp and PassiveStamp clients provide asynchronous versions for high-performance async/await operations.
from azure.mgmt.recoveryservicesbackup.activestamp.aio import RecoveryServicesBackupClient as AsyncActiveClient
from azure.mgmt.recoveryservicesbackup.passivestamp.aio import RecoveryServicesBackupPassiveClient as AsyncPassiveClient
class AsyncActiveClient:
def __init__(
self,
credential: AsyncTokenCredential,
subscription_id: str,
base_url: str = "https://management.azure.com",
**kwargs
): ...
async def close(self) -> None:
"""Close the async client and release resources."""
class AsyncPassiveClient:
def __init__(
self,
credential: AsyncTokenCredential,
subscription_id: str,
base_url: str = "https://management.azure.com",
**kwargs
): ...
async def close(self) -> None:
"""Close the async client and release resources."""Usage example:
import asyncio
from azure.identity.aio import DefaultAzureCredential
from azure.mgmt.recoveryservicesbackup.activestamp.aio import RecoveryServicesBackupClient
async def main():
credential = DefaultAzureCredential()
client = RecoveryServicesBackupClient(
credential=credential,
subscription_id=subscription_id
)
try:
policies = []
async for policy in client.backup_policies.list("my-rg", "my-vault"):
policies.append(policy)
finally:
await client.close()
asyncio.run(main())All clients support multiple authentication methods through the Azure Identity library.
# Environment-based authentication (recommended)
from azure.identity import DefaultAzureCredential
credential = DefaultAzureCredential()
# Service principal authentication
from azure.identity import ClientSecretCredential
credential = ClientSecretCredential(
tenant_id="your-tenant-id",
client_id="your-client-id",
client_secret="your-client-secret"
)
# Managed identity authentication
from azure.identity import ManagedIdentityCredential
credential = ManagedIdentityCredential()
# Interactive browser authentication
from azure.identity import InteractiveBrowserCredential
credential = InteractiveBrowserCredential()Clients support various configuration options for customization and optimization.
from azure.core.credentials import TokenCredential
from azure.core.pipeline.policies import RetryPolicy
client = RecoveryServicesBackupClient(
credential=credential,
subscription_id=subscription_id,
base_url="https://management.azure.com",
# Custom retry policy
retry_policy=RetryPolicy(retry_total=5),
# Request timeout
timeout=300,
# Custom headers
headers={"User-Agent": "MyApp/1.0"},
# Logging level
logging_enable=True,
# Connection pool settings
connection_pool_size=20
)from azure.core.credentials import TokenCredential
# For async clients
from azure.core.credentials_async import AsyncTokenCredential
# Client configuration types
ClientConfiguration = Dict[str, Any]Install with Tessl CLI
npx tessl i tessl/pypi-azure-mgmt-recoveryservicesbackup