Microsoft Azure Data Migration Client Library for Python providing comprehensive database migration management capabilities
Management of Azure Data Migration Service instances, which provide the infrastructure for running database migration projects. Services can be started, stopped, configured, and monitored through this API.
Create, update, and delete Azure Data Migration Service instances with full lifecycle management including provisioning, configuration updates, and cleanup.
def begin_create_or_update(
group_name: str,
service_name: str,
parameters: DataMigrationService,
**kwargs
) -> LROPoller[DataMigrationService]:
"""
Create or update a Data Migration Service instance.
Parameters:
- group_name: Name of the resource group
- service_name: Name of the service
- parameters: Service configuration parameters
Returns:
LROPoller for the long-running operation
"""
def get(
group_name: str,
service_name: str,
**kwargs
) -> DataMigrationService:
"""
Get details of a Data Migration Service.
Parameters:
- group_name: Name of the resource group
- service_name: Name of the service
Returns:
DataMigrationService instance details
"""
def begin_delete(
group_name: str,
service_name: str,
**kwargs
) -> LROPoller[None]:
"""
Delete a Data Migration Service instance.
Parameters:
- group_name: Name of the resource group
- service_name: Name of the service
Returns:
LROPoller for the long-running operation
"""
def begin_update(
group_name: str,
service_name: str,
parameters: DataMigrationService,
**kwargs
) -> LROPoller[DataMigrationService]:
"""
Update an existing Data Migration Service.
Parameters:
- group_name: Name of the resource group
- service_name: Name of the service
- parameters: Updated service parameters
Returns:
LROPoller for the long-running operation
"""Start and stop Data Migration Service instances to control their operational state and manage resource consumption.
def begin_start(
group_name: str,
service_name: str,
**kwargs
) -> LROPoller[None]:
"""
Start a Data Migration Service instance.
Parameters:
- group_name: Name of the resource group
- service_name: Name of the service
Returns:
LROPoller for the long-running operation
"""
def begin_stop(
group_name: str,
service_name: str,
**kwargs
) -> LROPoller[None]:
"""
Stop a Data Migration Service instance.
Parameters:
- group_name: Name of the resource group
- service_name: Name of the service
Returns:
LROPoller for the long-running operation
"""
def check_status(
group_name: str,
service_name: str,
**kwargs
) -> DataMigrationServiceStatusResponse:
"""
Check the status of a Data Migration Service.
Parameters:
- group_name: Name of the resource group
- service_name: Name of the service
Returns:
Service status information
"""List and discover Data Migration Services across subscriptions and resource groups for inventory and management purposes.
def list(**kwargs) -> ItemPaged[DataMigrationService]:
"""
List all Data Migration Services in the subscription.
Returns:
Paginated list of all services
"""
def list_by_resource_group(
group_name: str,
**kwargs
) -> ItemPaged[DataMigrationService]:
"""
List Data Migration Services in a specific resource group.
Parameters:
- group_name: Name of the resource group
Returns:
Paginated list of services in the resource group
"""Check service name availability and discover available SKUs for service configuration and capacity planning.
def check_name_availability(
parameters: NameAvailabilityRequest,
**kwargs
) -> NameAvailabilityResponse:
"""
Check if a service name is available.
Parameters:
- parameters: Name availability request
Returns:
Availability status and alternative suggestions
"""
def check_children_name_availability(
group_name: str,
service_name: str,
parameters: NameAvailabilityRequest,
**kwargs
) -> NameAvailabilityResponse:
"""
Check name availability for child resources.
Parameters:
- group_name: Name of the resource group
- service_name: Name of the service
- parameters: Name availability request
Returns:
Availability status for child resources
"""
def list_skus(
group_name: str,
service_name: str,
**kwargs
) -> ItemPaged[AvailableServiceSku]:
"""
List available SKUs for a service.
Parameters:
- group_name: Name of the resource group
- service_name: Name of the service
Returns:
Available SKU options for the service
"""from azure.mgmt.datamigration import DataMigrationManagementClient
from azure.mgmt.datamigration.models import DataMigrationService
from azure.identity import DefaultAzureCredential
credential = DefaultAzureCredential()
client = DataMigrationManagementClient(credential, "subscription-id")
# Create service configuration
service_params = DataMigrationService(
location="East US",
kind="Cloud",
virtual_subnet_id="/subscriptions/.../virtualNetworks/vnet/subnets/subnet"
)
# Create the service (long-running operation)
operation = client.services.begin_create_or_update(
group_name="my-rg",
service_name="my-migration-service",
parameters=service_params
)
# Wait for completion
service = operation.result()
print(f"Service created: {service.name}, State: {service.provisioning_state}")# Start the service
start_operation = client.services.begin_start(
group_name="my-rg",
service_name="my-migration-service"
)
start_operation.wait()
# Check service status
status = client.services.check_status(
group_name="my-rg",
service_name="my-migration-service"
)
print(f"Service status: {status.status}")
# Stop the service when not needed
stop_operation = client.services.begin_stop(
group_name="my-rg",
service_name="my-migration-service"
)
stop_operation.wait()class DataMigrationService:
"""Data Migration Service configuration and state."""
name: str
type: str
location: str
kind: str # "Cloud" or "Hybrid"
provisioning_state: str # "Accepted", "Deleting", "Deploying", "Stopped", "Stopping", "Starting", "Failed", "Succeeded"
public_key: str
virtual_subnet_id: str
sku: ServiceSku
etag: str
class ServiceSku:
"""Service SKU configuration."""
name: str # SKU name
tier: str # SKU tier
family: str # SKU family
size: str # SKU size
capacity: int # SKU capacity
class DataMigrationServiceStatusResponse:
"""Service status information."""
agent_version: str
status: str
vm_size: str
class NameAvailabilityRequest:
"""Request to check name availability."""
name: str
type: str
class NameAvailabilityResponse:
"""Response for name availability check."""
name_available: bool
reason: str # NameCheckFailureReason enum
message: str
class AvailableServiceSku:
"""Available SKU information."""
resource_type: str
sku: AvailableServiceSkuSku
capacity: AvailableServiceSkuCapacitytessl i tessl/pypi-azure-mgmt-datamigration@9.0.0