{"id":1362,"library":"azure-mgmt-datamigration","title":"Microsoft Azure Data Migration Client Library for Python","description":"The `azure-mgmt-datamigration` library provides client-side functionality for interacting with the Azure Data Migration Service, allowing programmatic management of data migration tasks to Azure data platforms. It is part of the Azure SDK for Python, currently at version 10.1.0, and follows the modern Azure SDK guidelines, with regular updates and releases.","status":"active","version":"10.1.0","language":"en","source_language":"en","source_url":"https://github.com/Azure/azure-sdk-for-python","tags":["azure","management","data migration","cloud","sdk"],"install":[{"cmd":"pip install azure-mgmt-datamigration azure-identity","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Required for modern Azure Active Directory-based authentication for Azure SDK clients.","package":"azure-identity","optional":false},{"reason":"Core utilities and exceptions for Azure SDKs.","package":"azure-core","optional":false},{"reason":"Azure-specific extensions for msrest client runtime.","package":"msrestazure","optional":false},{"reason":"Core client runtime for AutoRest generated Python clients.","package":"msrest","optional":false}],"imports":[{"symbol":"DataMigrationManagementClient","correct":"from azure.mgmt.datamigration import DataMigrationManagementClient"},{"symbol":"DefaultAzureCredential","correct":"from azure.identity import DefaultAzureCredential"}],"quickstart":{"code":"import os\nfrom azure.identity import DefaultAzureCredential\nfrom azure.mgmt.datamigration import DataMigrationManagementClient\n\n# Set your Azure Subscription ID as an environment variable or replace directly\nsubscription_id = os.environ.get(\"AZURE_SUBSCRIPTION_ID\", \"<your-subscription-id>\")\n\n# Acquire a credential using DefaultAzureCredential. This will try various methods\n# like environment variables (AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET),\n# Azure CLI, Managed Identity, etc.\ncredential = DefaultAzureCredential()\n\n# Create a DataMigrationManagementClient\nclient = DataMigrationManagementClient(credential, subscription_id)\n\n# Example: List all Data Migration Services in a resource group\nresource_group_name = os.environ.get(\"AZURE_RESOURCE_GROUP\", \"<your-resource-group>\")\nprint(f\"Listing Data Migration Services in resource group: {resource_group_name}\")\n\ntry:\n    for service in client.services.list_by_resource_group(resource_group_name):\n        print(f\"  Service Name: {service.name}, Location: {service.location}\")\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")\n    print(\"Please ensure AZURE_SUBSCRIPTION_ID and AZURE_RESOURCE_GROUP are set,\")\n    print(\"and that your principal has 'Reader' permissions on the resource group.\")","lang":"python","description":"This quickstart demonstrates how to authenticate with Azure using `DefaultAzureCredential` and list Data Migration Services within a specified resource group. Ensure you have the necessary environment variables (`AZURE_SUBSCRIPTION_ID`, `AZURE_RESOURCE_GROUP`) set for authentication and operation."},"warnings":[{"fix":"Migrate authentication to `azure-identity` library (e.g., `DefaultAzureCredential`). Update client instantiation to use `credential=DefaultAzureCredential()` and ensure `subscription_id` is passed. [2, 5, 7]","message":"Version 9.0.0b1 introduced significant breaking changes, revamping the authentication system. Old `azure.common.credentials` or `msrestazure.azure_active_directory` are no longer supported; use `azure-identity` classes instead. The `credentials` parameter was also renamed to `credential`.","severity":"breaking","affected_versions":">=9.0.0b1"},{"fix":"Adjust import paths to `from azure.mgmt.datamigration import ...`. For long-running operations, use methods prefixed with `begin_` and expect `azure.core.polling.LROPoller`. [5]","message":"Older versions (e.g., 3.0.0) introduced breaking changes related to module visibility and renaming. Direct imports from sub-modules like `data_migration_service_client` for `DataMigrationServiceManagementClient`, or `models.my_class`, `operations.my_class_operations` are no longer supported. Operation methods returning `msrest.polling.LROPoller` were changed to `azure.core.polling.LROPoller` and prefixed with `begin_`.","severity":"breaking","affected_versions":">=3.0.0, <9.0.0b1"},{"fix":"Ensure required environment variables are correctly set for service principal authentication, or that you are logged in via Azure CLI/configured for Managed Identity. Refer to `azure-identity` documentation for credential precedence. [2, 5, 7, 8, 11, 12]","message":"`DefaultAzureCredential` relies on specific environment variables (e.g., `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`, `AZURE_SUBSCRIPTION_ID`) or other configured authentication methods (Azure CLI, Managed Identity). Misconfiguration is a common source of `ClientAuthenticationError`.","severity":"gotcha","affected_versions":"All"},{"fix":"Divide large migrations into multiple activities, each handling four or fewer databases. If parallel migrations are needed for more databases, provision additional Azure Database Migration Service instances. [16]","message":"The Azure Database Migration Service has operational limits, such as a maximum of four databases per migration activity. Attempting to migrate more than this limit in a single activity will result in a validation error.","severity":"gotcha","affected_versions":"All"},{"fix":"Thoroughly review network configurations, firewall rules, and DNS settings. For SQL Server, ensure static ports are used or that the SQL Server Browser service (UDP port 1434) is reachable if dynamic ports/named instances are necessary. For ExpressRoute, confirm required service endpoints are provisioned. [14, 16]","message":"Network and DNS misconfigurations, including dynamic ports for SQL Server instances, incorrect ExpressRoute setup, or firewall rules, are frequent causes of connection failures during migration setup within the Data Migration Service.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}