CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-azure-mgmt-recoveryservices

Microsoft Azure Recovery Services Client Library for Python providing comprehensive APIs for managing Recovery Services vaults, certificates, private endpoints, and usage monitoring.

Pending

Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

Overview
Eval results
Files

vault-management.mddocs/

Vault Management

Comprehensive functionality for managing Azure Recovery Services vaults including creation, configuration, updates, deletion, and querying. Recovery Services vaults serve as containers for backup and disaster recovery operations, providing secure storage and management capabilities for protecting Azure resources.

Capabilities

List Vaults by Subscription

Retrieves all Recovery Services vaults in the specified Azure subscription.

def list_by_subscription_id(**kwargs) -> ItemPaged[Vault]:
    """
    Fetches all the recovery services vaults in the subscription.
    
    Returns:
    ItemPaged[Vault]: An iterator of Vault objects
    """

Usage Example:

# List all vaults in subscription
vaults = client.vaults.list_by_subscription_id()
for vault in vaults:
    print(f"Vault: {vault.name}")
    print(f"  Location: {vault.location}")
    print(f"  SKU: {vault.sku.name}")
    print(f"  Resource Group: {vault.id.split('/')[4]}")

List Vaults by Resource Group

Retrieves all Recovery Services vaults within a specific resource group.

def list_by_resource_group(resource_group_name: str, **kwargs) -> ItemPaged[Vault]:
    """
    Retrieve a list of vaults within the given resource group.
    
    Parameters:
    - resource_group_name: str - The name of the resource group
    
    Returns:
    ItemPaged[Vault]: An iterator of Vault objects
    """

Usage Example:

# List vaults in specific resource group
resource_group = "my-backup-rg"
vaults = client.vaults.list_by_resource_group(resource_group)
for vault in vaults:
    print(f"Vault: {vault.name} in {vault.location}")

Get Vault Details

Retrieves detailed information about a specific Recovery Services vault.

def get(resource_group_name: str, vault_name: str, **kwargs) -> Vault:
    """
    Get the details of the recovery services vault.
    
    Parameters:
    - resource_group_name: str - The name of the resource group
    - vault_name: str - The name of the recovery services vault
    
    Returns:
    Vault: The vault resource
    """

Usage Example:

# Get specific vault details
vault = client.vaults.get("my-rg", "my-vault")
print(f"Vault ID: {vault.id}")
print(f"Properties: {vault.properties}")
print(f"Identity: {vault.identity}")

# Access vault properties
if vault.properties:
    print(f"Private Endpoint Connections: {len(vault.properties.private_endpoint_connections or [])}")
    print(f"Encryption: {vault.properties.encryption}")

Create or Update Vault

Creates a new Recovery Services vault or updates an existing one. This is a long-running operation.

def begin_create_or_update(
    resource_group_name: str, 
    vault_name: str, 
    vault: Union[Vault, IO[bytes]], 
    x_ms_authorization_auxiliary: Optional[str] = None, 
    **kwargs
) -> LROPoller[Vault]:
    """
    Creates or updates a Recovery Services vault.
    
    Parameters:
    - resource_group_name: str - The name of the resource group
    - vault_name: str - The name of the recovery services vault
    - vault: Union[Vault, IO[bytes]] - Recovery Services Vault to be created or updated
    - x_ms_authorization_auxiliary: Optional[str] - Additional authorization header
    
    Returns:
    LROPoller[Vault]: Long-running operation poller returning the created/updated vault
    """

Usage Example:

from azure.mgmt.recoveryservices.models import Vault, Sku, SkuName, IdentityData, ResourceIdentityType

# Create a new vault with system-assigned identity
new_vault = Vault(
    location="eastus",
    sku=Sku(name=SkuName.STANDARD),
    identity=IdentityData(type=ResourceIdentityType.SYSTEM_ASSIGNED),
    tags={"Environment": "Production", "Department": "IT"}
)

# Start creation operation
operation = client.vaults.begin_create_or_update(
    "my-resource-group", 
    "my-new-vault", 
    new_vault
)

# Wait for completion
created_vault = operation.result()
print(f"Created vault: {created_vault.name}")
print(f"Vault ID: {created_vault.id}")

Update Vault

Updates properties of an existing Recovery Services vault. This is a long-running operation.

def begin_update(
    resource_group_name: str, 
    vault_name: str, 
    vault: Union[PatchVault, IO[bytes]], 
    x_ms_authorization_auxiliary: Optional[str] = None, 
    **kwargs
) -> LROPoller[Vault]:
    """
    Updates the vault.
    
    Parameters:
    - resource_group_name: str - The name of the resource group
    - vault_name: str - The name of the recovery services vault
    - vault: Union[PatchVault, IO[bytes]] - Recovery Services Vault patch request
    - x_ms_authorization_auxiliary: Optional[str] - Additional authorization header
    
    Returns:
    LROPoller[Vault]: Long-running operation poller returning the updated vault
    """

Usage Example:

from azure.mgmt.recoveryservices.models import PatchVault, IdentityData, ResourceIdentityType

# Update vault to add user-assigned identity
patch_vault = PatchVault(
    identity=IdentityData(
        type=ResourceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED,
        user_assigned_identities={
            "/subscriptions/.../resourceGroups/.../providers/Microsoft.ManagedIdentity/userAssignedIdentities/my-identity": {}
        }
    ),
    tags={"Updated": "true"}
)

# Start update operation
operation = client.vaults.begin_update(
    "my-resource-group",
    "my-vault", 
    patch_vault
)

updated_vault = operation.result()
print(f"Updated vault identity: {updated_vault.identity.type}")

Delete Vault

Deletes a Recovery Services vault. This is a long-running operation that permanently removes the vault and all associated data.

def begin_delete(resource_group_name: str, vault_name: str, **kwargs) -> LROPoller[None]:
    """
    Deletes a vault.
    
    Parameters:
    - resource_group_name: str - The name of the resource group
    - vault_name: str - The name of the recovery services vault
    
    Returns:
    LROPoller[None]: Long-running operation poller
    """

Usage Example:

# Delete a vault (WARNING: This permanently deletes the vault)
operation = client.vaults.begin_delete("my-resource-group", "vault-to-delete")

# Wait for deletion to complete
operation.result()
print("Vault deleted successfully")

# Check deletion status without waiting
if not operation.done():
    print("Deletion in progress...")
else:
    print("Deletion completed")

Related Types

Vault Configuration

class VaultProperties:
    """
    Properties of the vault.
    
    Parameters:
    - private_endpoint_state_for_backup: Optional[VaultPrivateEndpointState] - Private endpoint state for backup
    - private_endpoint_state_for_site_recovery: Optional[VaultPrivateEndpointState] - Private endpoint state for site recovery  
    - private_endpoint_connections: Optional[List[PrivateEndpointConnection]] - List of private endpoint connections
    - provisioning_state: Optional[str] - Provisioning State
    - upgrade_details: Optional[UpgradeDetails] - Details for upgrading vaults
    - public_network_access: Optional[PublicNetworkAccess] - Public network access setting
    - monitoring_settings: Optional[MonitoringSettings] - Monitoring settings
    - encryption: Optional[VaultPropertiesEncryption] - Customer Managed Key details
    - move_details: Optional[VaultPropertiesMoveDetails] - Move details
    - backup_storage_version: Optional[BackupStorageVersion] - Backup storage version
    - redundancy_settings: Optional[VaultPropertiesRedundancySettings] - Redundancy settings
    - security_settings: Optional[SecuritySettings] - Security settings
    - bcdr_security_level: Optional[BCDRSecurityLevel] - Security level for BCDR
    - restore_settings: Optional[RestoreSettings] - Restore settings
    """

Patch Operations

class PatchVault(PatchTrackedResource):
    """
    Patch Resource information for Vault.
    
    Parameters:
    - tags: Optional[Dict[str, str]] - Resource tags
    - location: Optional[str] - Resource location
    - identity: Optional[IdentityData] - Managed service identity
    - properties: Optional[VaultProperties] - Properties of the vault
    - sku: Optional[Sku] - Identifies the unique system identifier for each Azure resource
    """

Long-Running Operations

class LROPoller:
    """
    Long-running operation poller.
    
    Methods:
    - result(timeout: Optional[int] = None) -> T - Get the final result, waiting if necessary
    - done() -> bool - Check if the operation is complete
    - status() -> str - Get current operation status
    - wait(timeout: Optional[int] = None) -> None - Wait for operation completion
    """

Install with Tessl CLI

npx tessl i tessl/pypi-azure-mgmt-recoveryservices

docs

certificate-management.md

extended-vault-info.md

index.md

private-link-resources.md

service-operations.md

usage-monitoring.md

vault-management.md

tile.json