{"id":1379,"library":"azure-mgmt-recoveryservicesbackup","title":"Azure Recovery Services Backup Management","description":"The Azure Recoveryservicesbackup Management Client Library for Python allows developers to programmatically manage Azure Recovery Services Backup resources, including vaults, backup policies, protected items, and jobs. Version 10.0.0 aligns with the Azure SDK Track 2 guidelines. Azure SDKs typically have a frequent release cadence, often with minor updates and major releases tied to API version changes.","status":"active","version":"10.0.0","language":"en","source_language":"en","source_url":"https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/recoveryservicesbackup/azure-mgmt-recoveryservicesbackup","tags":["azure","cloud","backup","recovery","management"],"install":[{"cmd":"pip install azure-mgmt-recoveryservicesbackup azure-identity","lang":"bash","label":"Install core library and authentication"}],"dependencies":[{"reason":"Required for authentication with Azure services (e.g., DefaultAzureCredential). While a direct dependency, explicitly installing it ensures it's available for client credential setup.","package":"azure-identity","optional":false}],"imports":[{"note":"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.","wrong":"from azure.mgmt.recoveryservicesbackup.recoveryservicesbackup_management_client import RecoveryServicesBackupManagementClient","symbol":"RecoveryServicesBackupClient","correct":"from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient"}],"quickstart":{"code":"import os\nfrom azure.identity import DefaultAzureCredential\nfrom azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient\n\n# Replace with your actual subscription ID and resource details\n# It's recommended to set these as environment variables for production.\nsubscription_id = os.environ.get(\"AZURE_SUBSCRIPTION_ID\", \"<your-subscription-id>\")\nresource_group_name = os.environ.get(\"AZURE_RESOURCE_GROUP_NAME\", \"<your-resource-group>\")\nvault_name = os.environ.get(\"AZURE_RECOVERY_SERVICES_VAULT_NAME\", \"<your-recovery-services-vault-name>\")\n\n# Authenticate using DefaultAzureCredential\n# This tries several methods: environment variables, Azure CLI, Managed Identity, etc.\ncredential = DefaultAzureCredential()\n\n# Create the Backup Management client\nclient = RecoveryServicesBackupClient(credential, subscription_id)\n\nprint(f\"Listing backup policies in vault '{vault_name}' in resource group '{resource_group_name}'...\")\n\ntry:\n    # Example: List backup policies within a specified vault\n    # Note: Ensure the credential has 'Reader' access or higher to the vault/resource group.\n    policies = client.backup_policies.list(resource_group_name, vault_name)\n    for policy in policies:\n        print(f\"  - Policy Name: {policy.name}, State: {policy.properties.backup_management_type}\")\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")\n    print(\"Please ensure the vault, resource group, and subscription ID are correct and your credential has sufficient permissions.\")","lang":"python","description":"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)."},"warnings":[{"fix":"Migrate 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.","message":"Version 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.","severity":"breaking","affected_versions":"< 10.0.0 to 10.0.0+"},{"fix":"Ensure 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.","message":"Authentication 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.","severity":"gotcha","affected_versions":"All"},{"fix":"Always 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.","message":"Many 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.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}