Registry /
azure / azure-mgmt-recoveryservicesbackup
Install & Compatibility
Where this runs
tested against v11.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
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.788s · 47.3MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 4.0s · import 0.702s · 48MB
47MB installed
● package 47MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
RecoveryServicesBackupClient
✓ from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient
✗ from azure.mgmt.recoveryservicesbackup.recoveryservicesbackup_management_client import RecoveryServicesBackupManagementClient
Older versions (Track 1) typically had client classes with a '_management_client' suffix and a nested import path. 'RecoveryServicesBackupClient' is the current standard for Track 2.
This quickstart demonstrates how to instantiate the `RecoveryServicesBackupClient` using `DefaultAzureCredential` for authentication and then lists existing backup policies within a specified Recovery Services Vault. Ensure you have Azure credentials configured (e.g., via `az login` or environment variables).
import os
from azure.identity import DefaultAzureCredential
from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient
# Replace with your actual subscription ID and resource details
# It's recommended to set these as environment variables for production.
subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "<your-subscription-id>")
resource_group_name = os.environ.get("AZURE_RESOURCE_GROUP_NAME", "<your-resource-group>")
vault_name = os.environ.get("AZURE_RECOVERY_SERVICES_VAULT_NAME", "<your-recovery-services-vault-name>")
# Authenticate using DefaultAzureCredential
# This tries several methods: environment variables, Azure CLI, Managed Identity, etc.
credential = DefaultAzureCredential()
# Create the Backup Management client
client = RecoveryServicesBackupClient(credential, subscription_id)
print(f"Listing backup policies in vault '{vault_name}' in resource group '{resource_group_name}'...")
try:
# Example: List backup policies within a specified vault
# Note: Ensure the credential has 'Reader' access or higher to the vault/resource group.
policies = client.backup_policies.list(resource_group_name, vault_name)
for policy in policies:
print(f" - Policy Name: {policy.name}, State: {policy.properties.backup_management_type}")
except Exception as e:
print(f"An error occurred: {e}")
print("Please ensure the vault, resource group, and subscription ID are correct and your credential has sufficient permissions.")
Debug
Known issues
breakingVersion 10.0.0 marks a significant transition to Azure SDK Track 2 guidelines. This involves changes to client constructors, authentication mechanisms (requiring `azure-identity`), method signatures, and return types. Code written for older Track 1 versions (e.g., `< 10.0.0`) will not work without modification.fixMigrate your code to use the new Track 2 client instantiation (passing `credential` and `subscription_id`), adopt `DefaultAzureCredential` for authentication, and update method calls according to the latest documentation. Consult the official Azure SDK migration guides for detailed steps.
affects: < 10.0.0 to 10.0.0+
gotchaAuthentication is a common point of failure. `DefaultAzureCredential` requires proper environment configuration (e.g., `AZURE_TENANT_ID`, `AZURE_CLIENT_ID`, `AZURE_CLIENT_SECRET`) or an an active Azure CLI login (`az login`). Without valid credentials, client instantiation or subsequent API calls will fail with `CredentialUnavailableError` or similar.fixEnsure your environment variables are correctly set, or that you are logged into Azure CLI. For production, consider using Managed Identity or Service Principals with explicitly assigned roles for robust authentication.
affects: All
gotchaMany management operations require precise resource identifiers such as `subscription_id`, `resource_group_name`, `vault_name`, and nested resource names (e.g., `policy_name`). Incorrect or misspelled identifiers will lead to 'ResourceNotFound' errors or similar failures.fixAlways double-check resource names and IDs in the Azure portal or by using Azure CLI commands (e.g., `az backup vault list`, `az backup policy list`) to ensure accuracy. Pay attention to case sensitivity for some resource types.
affects: All
Upgrade
Version history
11.0.0latest on PyPI · released Aug 17, 2026
Audit
Dependencies
azure-identityrequiredRequired for authentication with Azure services (e.g., DefaultAzureCredential). While a direct dependency, explicitly installing it ensures it's available for client credential setup.