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

private-link-resources.mddocs/

Private Link Resources

Management of private endpoint connections and private link resources for Azure Recovery Services vaults. Private Link enables secure, private connectivity to Recovery Services vaults over Azure's backbone network, ensuring that backup and recovery traffic doesn't traverse the public internet.

Capabilities

List Private Link Resources

Retrieves all private link resources that need to be created for backup and site recovery operations.

def list(resource_group_name: str, vault_name: str, **kwargs) -> ItemPaged[PrivateLinkResource]:
    """
    Returns the list of private link resources that need to be created for Backup and SiteRecovery.
    
    Parameters:
    - resource_group_name: str - The name of the resource group
    - vault_name: str - The name of the recovery services vault
    
    Returns:
    ItemPaged[PrivateLinkResource]: An iterator of private link resources
    """

Usage Example:

# List all private link resources for a vault
private_link_resources = client.private_link_resources.list(
    resource_group_name="my-rg",
    vault_name="my-vault"
)

for resource in private_link_resources:
    print(f"Private Link Resource: {resource.name}")
    print(f"  Group IDs: {resource.properties.group_ids}")
    print(f"  Required Members: {resource.properties.required_members}")
    print(f"  Required Zone Names: {resource.properties.required_zone_names}")

Get Private Link Resource

Retrieves details about a specific private link resource.

def get(
    resource_group_name: str, 
    vault_name: str, 
    private_link_resource_name: str, 
    **kwargs
) -> PrivateLinkResource:
    """
    Returns a specified private link resource that needs to be created for Backup and SiteRecovery.
    
    Parameters:
    - resource_group_name: str - The name of the resource group
    - vault_name: str - The name of the recovery services vault
    - private_link_resource_name: str - The name of the private link resource
    
    Returns:
    PrivateLinkResource: The private link resource details
    """

Usage Example:

# Get specific private link resource
private_link_resource = client.private_link_resources.get(
    resource_group_name="my-rg",
    vault_name="my-vault",
    private_link_resource_name="AzureBackup"
)

print(f"Resource Name: {private_link_resource.name}")
print(f"Resource Type: {private_link_resource.type}")
print(f"Group IDs: {private_link_resource.properties.group_ids}")

# Check if DNS zone names are required
if private_link_resource.properties.required_zone_names:
    print("Required DNS Zones:")
    for zone in private_link_resource.properties.required_zone_names:
        print(f"  - {zone}")

Private Link Types

Private Link Resource

class PrivateLinkResource:
    """
    Information of the private link resource.
    
    Parameters:
    - id: Optional[str] - Fully qualified identifier of the resource
    - name: Optional[str] - Name of the resource
    - type: Optional[str] - Type of the resource
    - properties: Optional[PrivateLinkResourceProperties] - Properties of private link resource
    """

Private Link Resource Properties

class PrivateLinkResourceProperties:
    """
    Properties of a private link resource.
    
    Parameters:
    - group_ids: Optional[List[str]] - Group Ids of the private link resource
    - required_members: Optional[List[str]] - Required members of private link resource
    - required_zone_names: Optional[List[str]] - Required private DNS zone names
    """

Private Link Resources Collection

class PrivateLinkResources:
    """
    Class to represent the private link resources.
    
    Parameters:
    - value: Optional[List[PrivateLinkResource]] - List of private link resources
    - next_link: Optional[str] - Link to the next set of results
    """

Private Endpoint Connection

class PrivateEndpointConnection:
    """
    Private endpoint connection resource.
    
    Parameters:
    - id: Optional[str] - Fully qualified identifier of the resource
    - name: Optional[str] - Name of the resource  
    - type: Optional[str] - Type of the resource
    - properties: Optional[PrivateEndpointConnectionVaultProperties] - Private endpoint connection properties
    """

Private Endpoint Connection Properties

class PrivateEndpointConnectionVaultProperties:
    """
    Information of the private endpoint connection resource.
    
    Parameters:
    - private_endpoint: Optional[PrivateEndpoint] - Private endpoint resource
    - private_link_service_connection_state: Optional[PrivateLinkServiceConnectionState] - Connection state
    - provisioning_state: Optional[ProvisioningState] - Provisioning state of the private endpoint connection
    """

Private Endpoint

class PrivateEndpoint:
    """
    The Private Endpoint resource.
    
    Parameters:
    - id: Optional[str] - The ARM identifier for private endpoint
    """

Private Link Service Connection State

class PrivateLinkServiceConnectionState:
    """
    A collection of information about the state of the connection between service consumer and provider.
    
    Parameters:
    - status: Optional[PrivateEndpointConnectionStatus] - Connection status
    - description: Optional[str] - The reason for approval/rejection of the connection
    - actions_required: Optional[str] - A message indicating if changes on the service provider require any updates
    """

Enums

Private Endpoint Connection Status

class PrivateEndpointConnectionStatus(str, Enum):
    """
    The private endpoint connection status.
    """
    PENDING = "Pending"
    APPROVED = "Approved" 
    REJECTED = "Rejected"
    DISCONNECTED = "Disconnected"

Vault Private Endpoint State

class VaultPrivateEndpointState(str, Enum):
    """
    Private endpoint state for backup.
    """
    NONE = "None"
    ENABLED = "Enabled"

Vault Sub Resource Type

class VaultSubResourceType(str, Enum):
    """
    Sub-resource type for vault private endpoint.
    """
    AZURE_BACKUP = "AzureBackup"
    AZURE_BACKUP_SECONDARY = "AzureBackup_secondary"
    AZURE_SITE_RECOVERY = "AzureSiteRecovery"

Usage Patterns

Setting Up Private Endpoint

def setup_private_endpoint_for_vault(client, resource_group: str, vault_name: str):
    """
    Example of how to discover and set up private endpoints for a Recovery Services vault.
    Note: This example shows the discovery process. Actual private endpoint creation
    requires additional Azure networking resources and permissions.
    """
    
    print(f"Discovering private link resources for vault: {vault_name}")
    
    # List all available private link resources
    private_link_resources = client.private_link_resources.list(
        resource_group_name=resource_group,
        vault_name=vault_name
    )
    
    backup_resource = None
    site_recovery_resource = None
    
    for resource in private_link_resources:
        print(f"\nPrivate Link Resource: {resource.name}")
        print(f"  Type: {resource.type}")
        print(f"  Group IDs: {resource.properties.group_ids}")
        print(f"  Required Members: {resource.properties.required_members}")
        
        if resource.properties.required_zone_names:
            print(f"  Required DNS Zones:")
            for zone in resource.properties.required_zone_names:
                print(f"    - {zone}")
        
        # Identify backup and site recovery resources
        if resource.properties.group_ids and "AzureBackup" in resource.properties.group_ids:
            backup_resource = resource
        elif resource.properties.group_ids and "AzureSiteRecovery" in resource.properties.group_ids:
            site_recovery_resource = resource
    
    # Provide setup guidance
    if backup_resource:
        print(f"\nTo enable private endpoint for Azure Backup:")
        print(f"  - Create private endpoint for group ID: {backup_resource.properties.group_ids[0]}")
        if backup_resource.properties.required_zone_names:
            print(f"  - Configure private DNS zones: {', '.join(backup_resource.properties.required_zone_names)}")
    
    if site_recovery_resource:
        print(f"\nTo enable private endpoint for Azure Site Recovery:")
        print(f"  - Create private endpoint for group ID: {site_recovery_resource.properties.group_ids[0]}")
        if site_recovery_resource.properties.required_zone_names:
            print(f"  - Configure private DNS zones: {', '.join(site_recovery_resource.properties.required_zone_names)}")
    
    return {
        "backup_resource": backup_resource,
        "site_recovery_resource": site_recovery_resource
    }

Monitoring Private Endpoint Connections

def monitor_private_endpoint_connections(vault_properties):
    """
    Monitor the status of private endpoint connections for a vault.
    """
    
    if not vault_properties or not vault_properties.private_endpoint_connections:
        print("No private endpoint connections found")
        return
    
    print("Private Endpoint Connections Status:")
    
    for connection in vault_properties.private_endpoint_connections:
        print(f"\nConnection: {connection.name}")
        print(f"  ID: {connection.id}")
        
        if connection.properties:
            # Check connection state
            if connection.properties.private_link_service_connection_state:
                state = connection.properties.private_link_service_connection_state
                print(f"  Status: {state.status}")
                print(f"  Description: {state.description}")
                
                if state.actions_required:
                    print(f"  Actions Required: {state.actions_required}")
            
            # Check provisioning state
            if connection.properties.provisioning_state:
                print(f"  Provisioning State: {connection.properties.provisioning_state}")
            
            # Show private endpoint details
            if connection.properties.private_endpoint:
                print(f"  Private Endpoint ID: {connection.properties.private_endpoint.id}")

Checking Private Endpoint State

def check_vault_private_endpoint_state(vault):
    """
    Check the private endpoint state for backup and site recovery.
    """
    
    if not vault.properties:
        print("Vault properties not available")
        return
    
    props = vault.properties
    
    # Check backup private endpoint state
    if hasattr(props, 'private_endpoint_state_for_backup'):
        backup_state = props.private_endpoint_state_for_backup
        print(f"Private Endpoint State for Backup: {backup_state}")
        
        if backup_state == VaultPrivateEndpointState.ENABLED:
            print("  ✓ Private endpoints are enabled for backup operations")
        else:
            print("  ⚠ Private endpoints are not enabled for backup operations")
    
    # Check site recovery private endpoint state  
    if hasattr(props, 'private_endpoint_state_for_site_recovery'):
        sr_state = props.private_endpoint_state_for_site_recovery
        print(f"Private Endpoint State for Site Recovery: {sr_state}")
        
        if sr_state == VaultPrivateEndpointState.ENABLED:
            print("  ✓ Private endpoints are enabled for site recovery operations")
        else:
            print("  ⚠ Private endpoints are not enabled for site recovery operations")

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