CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-azure-mgmt-datamigration

Azure Data Migration Client Library for programmatically managing database migration services and operations.

Pending

Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

Overview
Eval results
Files

connection-configuration.mddocs/

Connection Configuration

Database connection classes and configuration for various source and target platforms. These classes encapsulate the connection details, authentication methods, and platform-specific settings required to connect to different database systems during migration operations.

Capabilities

SQL Server Connections

Connection configuration for SQL Server instances including on-premises, Azure SQL Database, Azure SQL Managed Instance, and cloud-hosted SQL Server.

class SqlConnectionInfo(ConnectionInfo):
    """SQL Server connection information."""
    
    def __init__(
        self,
        server_name: str,
        authentication: str,
        user_name: str = None,
        password: str = None,
        **kwargs
    ):
        """
        Initialize SQL Server connection.
        
        Parameters:
        - server_name: SQL Server instance name or FQDN
        - authentication: Authentication type
        - database_name: Database name (optional)
        - user_name: Username for SQL authentication
        - password: Password for SQL authentication
        - encrypt_connection: Enable SSL encryption
        - trust_server_certificate: Trust server certificate
        - connection_timeout: Connection timeout in seconds
        """
    
    # Properties
    server_name: str  # Required: Server name or FQDN
    database_name: str  # Database name
    authentication: str  # SqlAuthentication, WindowsAuthentication, ActiveDirectoryPassword, etc.
    user_name: str  # Username for SQL auth
    password: str  # Password for SQL auth
    encrypt_connection: bool  # Enable encryption
    trust_server_certificate: bool  # Trust server certificate
    connection_timeout: int  # Connection timeout in seconds
    additional_settings: str  # Additional connection string parameters

Usage Example:

from azure.mgmt.datamigration.models import SqlConnectionInfo

# SQL Server with SQL Authentication
sql_connection = SqlConnectionInfo(
    server_name="myserver.database.windows.net",
    database_name="MyDatabase",
    authentication="SqlAuthentication",
    user_name="myusername", 
    password="mypassword",
    encrypt_connection=True,
    trust_server_certificate=False,
    connection_timeout=30
)

# SQL Server with Windows Authentication
sql_connection_windows = SqlConnectionInfo(
    server_name="on-premises-server\\SQLEXPRESS",
    authentication="WindowsAuthentication",
    encrypt_connection=False,
    trust_server_certificate=True
)

MySQL Connections

Connection configuration for MySQL servers including on-premises MySQL, Amazon RDS for MySQL, and cloud-hosted MySQL instances.

class MySqlConnectionInfo(ConnectionInfo):
    """MySQL connection information."""
    
    def __init__(
        self,
        server_name: str,
        port: int,
        user_name: str,
        password: str,
        **kwargs
    ):
        """
        Initialize MySQL connection.
        
        Parameters:
        - server_name: MySQL server hostname or IP
        - port: MySQL server port (typically 3306)
        - user_name: MySQL username
        - password: MySQL password
        - encrypt_connection: Enable SSL encryption
        """
    
    # Properties
    server_name: str  # Required: Server hostname or IP
    port: int  # Required: Server port (typically 3306)
    user_name: str  # Required: MySQL username
    password: str  # Required: MySQL password
    encrypt_connection: bool  # Enable SSL encryption

Usage Example:

from azure.mgmt.datamigration.models import MySqlConnectionInfo

mysql_connection = MySqlConnectionInfo(
    server_name="mysql-server.example.com",
    port=3306,
    user_name="mysql_user",
    password="mysql_password", 
    encrypt_connection=True
)

PostgreSQL Connections

Connection configuration for PostgreSQL servers including on-premises PostgreSQL, Amazon RDS for PostgreSQL, and Google Cloud SQL for PostgreSQL.

class PostgreSqlConnectionInfo(ConnectionInfo):
    """PostgreSQL connection information."""
    
    def __init__(
        self,
        server_name: str,
        port: int,
        database_name: str,
        user_name: str,
        password: str,
        **kwargs
    ):
        """
        Initialize PostgreSQL connection.
        
        Parameters:
        - server_name: PostgreSQL server hostname or IP
        - port: PostgreSQL server port (typically 5432)
        - database_name: Database name
        - user_name: PostgreSQL username
        - password: PostgreSQL password
        - encrypt_connection: Enable SSL encryption
        - trust_server_certificate: Trust server certificate
        """
    
    # Properties
    server_name: str  # Required: Server hostname or IP
    port: int  # Required: Server port (typically 5432)
    database_name: str  # Required: Database name
    user_name: str  # Required: PostgreSQL username
    password: str  # Required: PostgreSQL password
    encrypt_connection: bool  # Enable SSL encryption
    trust_server_certificate: bool  # Trust server certificate

Usage Example:

from azure.mgmt.datamigration.models import PostgreSqlConnectionInfo

postgresql_connection = PostgreSqlConnectionInfo(
    server_name="postgresql-server.example.com",
    port=5432,
    database_name="mydatabase",
    user_name="postgres_user",
    password="postgres_password",
    encrypt_connection=True,
    trust_server_certificate=False
)

Oracle Connections

Connection configuration for Oracle Database instances including on-premises Oracle, Oracle Cloud, and Amazon RDS for Oracle.

class OracleConnectionInfo(ConnectionInfo):
    """Oracle connection information."""
    
    def __init__(
        self,
        server_name: str,
        user_name: str,
        password: str,
        **kwargs
    ):
        """
        Initialize Oracle connection.
        
        Parameters:
        - server_name: Oracle server hostname or TNS name
        - user_name: Oracle username
        - password: Oracle password
        - port: Oracle listener port (typically 1521)
        - service_name: Oracle service name
        """
    
    # Properties
    server_name: str  # Required: Server hostname or TNS name
    user_name: str  # Required: Oracle username  
    password: str  # Required: Oracle password
    port: int  # Oracle listener port (typically 1521)
    service_name: str  # Oracle service name

Usage Example:

from azure.mgmt.datamigration.models import OracleConnectionInfo

oracle_connection = OracleConnectionInfo(
    server_name="oracle-server.example.com",
    port=1521,
    service_name="ORCL",
    user_name="oracle_user",
    password="oracle_password"
)

MongoDB Connections

Connection configuration for MongoDB instances including on-premises MongoDB, MongoDB Atlas, and Amazon DocumentDB.

class MongoDbConnectionInfo(ConnectionInfo):
    """MongoDB connection information."""
    
    def __init__(
        self,
        connection_string: str,
        **kwargs
    ):
        """
        Initialize MongoDB connection.
        
        Parameters:
        - connection_string: MongoDB connection string
        """
    
    # Properties
    connection_string: str  # Required: Full MongoDB connection string

Usage Example:

from azure.mgmt.datamigration.models import MongoDbConnectionInfo

# MongoDB with authentication
mongodb_connection = MongoDbConnectionInfo(
    connection_string="mongodb://username:password@mongodb-server:27017/database?authSource=admin"
)

# MongoDB Atlas connection
mongodb_atlas_connection = MongoDbConnectionInfo(
    connection_string="mongodb+srv://username:password@cluster.mongodb.net/database?retryWrites=true&w=majority"
)

SQL Managed Instance Connections

Specialized connection information for Azure SQL Managed Instance targets.

class MiSqlConnectionInfo(ConnectionInfo):
    """SQL Managed Instance connection information."""
    
    def __init__(
        self,
        managed_instance_resource_id: str,
        user_name: str,
        password: str,
        **kwargs
    ):
        """
        Initialize SQL Managed Instance connection.
        
        Parameters:
        - managed_instance_resource_id: Azure resource ID of the Managed Instance
        - user_name: SQL username
        - password: SQL password
        """
    
    # Properties
    managed_instance_resource_id: str  # Required: MI resource ID
    user_name: str  # Required: SQL username
    password: str  # Required: SQL password

Base Connection Types

ConnectionInfo

class ConnectionInfo:
    """Base class for all connection information."""
    
    def __init__(self, type: str, **kwargs):
        """
        Base connection information.
        
        Parameters:
        - type: Connection type identifier
        - user_name: Username for authentication
        - password: Password for authentication
        """
    
    # Properties
    type: str  # Required: Connection type
    user_name: str  # Username for authentication
    password: str  # Password for authentication

Authentication Types

SQL Server Authentication Types

  • SqlAuthentication: Standard SQL Server username/password authentication
  • WindowsAuthentication: Windows Integrated authentication
  • ActiveDirectoryPassword: Azure Active Directory password authentication
  • ActiveDirectoryIntegrated: Azure Active Directory integrated authentication

Connection Security

Most connection types support these security options:

  • encrypt_connection: Enable SSL/TLS encryption for data in transit
  • trust_server_certificate: Whether to trust the server's SSL certificate
  • connection_timeout: Connection timeout in seconds (default varies by platform)

Connection Validation

Before using connections in migration tasks, validate them using connection test tasks:

from azure.mgmt.datamigration.models import (
    ConnectToSourceSqlServerTaskProperties,
    ConnectToSourceSqlServerTaskInput,
    ProjectTask
)

# Create connection test task
test_task_properties = ConnectToSourceSqlServerTaskProperties(
    input=ConnectToSourceSqlServerTaskInput(
        source_connection_info=sql_connection,
        check_permissions_group="Default"
    )
)

test_task = ProjectTask(
    properties=test_task_properties
)

# Execute the connection test
task_result = client.tasks.create_or_update(
    group_name="myResourceGroup",
    service_name="myMigrationService", 
    project_name="myProject",
    task_name="connectionTest",
    parameters=test_task
)

Error Handling

Common connection-related errors:

  • Authentication failures: Invalid credentials or authentication method
  • Network connectivity: Server unreachable or firewall blocking connections
  • SSL/TLS errors: Certificate validation or encryption negotiation failures
  • Permission errors: User lacks required database permissions
  • Connection timeout: Server not responding within timeout period

Always test connections before using them in migration tasks to identify and resolve configuration issues early in the migration process.

Install with Tessl CLI

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

docs

connection-configuration.md

file-management.md

index.md

migration-task-types.md

project-management.md

resource-information.md

service-management.md

service-tasks.md

task-execution.md

tile.json