0
# Azure Data Migration Management Client
1
2
A comprehensive Python client library for Microsoft Azure Data Migration services, implementing Azure Resource Manager (ARM) APIs for managing database migration operations. This library enables developers to programmatically create, configure, and monitor data migration projects and services within the Azure ecosystem, supporting various database migration scenarios including SQL Server to Azure SQL Database, MySQL migrations, Oracle to PostgreSQL, and MongoDB migrations.
3
4
## Package Information
5
6
- **Package Name**: azure-mgmt-datamigration
7
- **Language**: Python
8
- **Installation**: `pip install azure-mgmt-datamigration`
9
- **Dependencies**: azure-mgmt-core, msrest, azure-common
10
- **License**: MIT
11
12
## Core Imports
13
14
```python
15
from azure.mgmt.datamigration import DataMigrationManagementClient
16
```
17
18
For async operations:
19
20
```python
21
from azure.mgmt.datamigration.aio import DataMigrationManagementClient
22
```
23
24
Common models and types:
25
26
```python
27
from azure.mgmt.datamigration.models import (
28
DataMigrationService,
29
Project,
30
ProjectTask,
31
SqlConnectionInfo,
32
MySqlConnectionInfo,
33
PostgreSqlConnectionInfo,
34
MongoDbConnectionInfo
35
)
36
```
37
38
## Basic Usage
39
40
```python
41
from azure.identity import DefaultAzureCredential
42
from azure.mgmt.datamigration import DataMigrationManagementClient
43
44
# Create the client
45
credential = DefaultAzureCredential()
46
client = DataMigrationManagementClient(
47
credential=credential,
48
subscription_id="your-subscription-id"
49
)
50
51
# List migration services
52
services = client.services.list()
53
for service in services:
54
print(f"Service: {service.name}, Location: {service.location}")
55
56
# Get service details
57
service = client.services.get(
58
group_name="myResourceGroup",
59
service_name="myMigrationService"
60
)
61
62
# List projects in a service
63
projects = client.projects.list(
64
group_name="myResourceGroup",
65
service_name="myMigrationService"
66
)
67
68
# Create a new migration project
69
from azure.mgmt.datamigration.models import Project
70
71
project_params = Project(
72
location="eastus",
73
source_platform="SQL",
74
target_platform="SQLDB"
75
)
76
77
project = client.projects.create_or_update(
78
group_name="myResourceGroup",
79
service_name="myMigrationService",
80
project_name="myProject",
81
parameters=project_params
82
)
83
84
print(f"Created project: {project.name}")
85
```
86
87
## Architecture
88
89
The Azure Data Migration Management Client follows Azure Resource Manager patterns and provides:
90
91
- **Client Classes**: Main entry points (sync/async) for all operations
92
- **Operation Groups**: Logical groupings of related functionality (services, projects, tasks, files)
93
- **Models**: Comprehensive data structures for all migration scenarios and configurations
94
- **Connection Info**: Database-specific connection classes for various platforms
95
- **Task Properties**: Specialized classes for different migration and validation operations
96
- **Long-Running Operations**: Support for Azure ARM polling patterns for time-intensive operations
97
98
The library abstracts the complexity of Azure's Data Migration Service REST APIs while providing full access to advanced migration features, monitoring capabilities, and multi-database platform support.
99
100
## Capabilities
101
102
### Service Management
103
104
Core operations for managing Azure Data Migration Service instances, including creation, configuration, lifecycle management, and monitoring.
105
106
```python { .api }
107
# Key service operations
108
def begin_create_or_update(group_name: str, service_name: str, parameters: DataMigrationService) -> LROPoller[DataMigrationService]: ...
109
def get(group_name: str, service_name: str) -> DataMigrationService: ...
110
def begin_delete(group_name: str, service_name: str) -> LROPoller[None]: ...
111
def begin_start(group_name: str, service_name: str) -> LROPoller[None]: ...
112
def begin_stop(group_name: str, service_name: str) -> LROPoller[None]: ...
113
def list() -> ItemPaged[DataMigrationService]: ...
114
```
115
116
[Service Management](./service-management.md)
117
118
### Project Management
119
120
Operations for managing migration projects within Data Migration services, organizing related migration tasks and configurations.
121
122
```python { .api }
123
# Key project operations
124
def create_or_update(group_name: str, service_name: str, project_name: str, parameters: Project) -> Project: ...
125
def get(group_name: str, service_name: str, project_name: str) -> Project: ...
126
def delete(group_name: str, service_name: str, project_name: str) -> None: ...
127
def list(group_name: str, service_name: str) -> ItemPaged[Project]: ...
128
```
129
130
[Project Management](./project-management.md)
131
132
### Task Execution
133
134
Execute and manage various migration and validation tasks including connection testing, schema migration, data migration, and assessment operations.
135
136
```python { .api }
137
# Key task operations
138
def create_or_update(group_name: str, service_name: str, project_name: str, task_name: str, parameters: ProjectTask) -> ProjectTask: ...
139
def get(group_name: str, service_name: str, project_name: str, task_name: str) -> ProjectTask: ...
140
def cancel(group_name: str, service_name: str, project_name: str, task_name: str) -> ProjectTask: ...
141
def command(group_name: str, service_name: str, project_name: str, task_name: str, parameters: CommandProperties) -> CommandProperties: ...
142
```
143
144
[Task Execution](./task-execution.md)
145
146
### Connection Configuration
147
148
Database connection classes and configuration for various source and target platforms including SQL Server, MySQL, Oracle, PostgreSQL, and MongoDB.
149
150
```python { .api }
151
# Connection info classes
152
class SqlConnectionInfo(ConnectionInfo): ...
153
class MySqlConnectionInfo(ConnectionInfo): ...
154
class PostgreSqlConnectionInfo(ConnectionInfo): ...
155
class OracleConnectionInfo(ConnectionInfo): ...
156
class MongoDbConnectionInfo(ConnectionInfo): ...
157
```
158
159
[Connection Configuration](./connection-configuration.md)
160
161
### Migration Task Types
162
163
Specialized task property classes for different migration scenarios, validation operations, and database-specific migration workflows.
164
165
```python { .api }
166
# SQL Server migration tasks
167
class MigrateSqlServerSqlDbTaskProperties(ProjectTaskProperties): ...
168
class MigrateSqlServerSqlMITaskProperties(ProjectTaskProperties): ...
169
170
# MySQL migration tasks
171
class MigrateMySqlAzureDbForMySqlOfflineTaskProperties(ProjectTaskProperties): ...
172
class MigrateMySqlAzureDbForMySqlSyncTaskProperties(ProjectTaskProperties): ...
173
174
# Oracle migration tasks
175
class MigrateOracleAzureDbForPostgreSqlSyncTaskProperties(ProjectTaskProperties): ...
176
```
177
178
[Migration Task Types](./migration-task-types.md)
179
180
### File Management
181
182
Operations for managing project files including migration scripts, configuration files, and other migration assets.
183
184
```python { .api }
185
# Key file operations
186
def create_or_update(group_name: str, service_name: str, project_name: str, file_name: str, parameters: ProjectFile) -> ProjectFile: ...
187
def get(group_name: str, service_name: str, project_name: str, file_name: str) -> ProjectFile: ...
188
def read(group_name: str, service_name: str, project_name: str, file_name: str) -> FileStorageInfo: ...
189
```
190
191
[File Management](./file-management.md)
192
193
### Service Tasks
194
195
Service-level tasks that operate independently of specific projects, including driver management and service-wide operations.
196
197
```python { .api }
198
# Key service task operations
199
def create_or_update(group_name: str, service_name: str, task_name: str, parameters: ProjectTask) -> ProjectTask: ...
200
def get(group_name: str, service_name: str, task_name: str) -> ProjectTask: ...
201
def cancel(group_name: str, service_name: str, task_name: str) -> ProjectTask: ...
202
```
203
204
[Service Tasks](./service-tasks.md)
205
206
### Resource Information
207
208
Operations for retrieving resource usage, quotas, available SKUs, and API operation information.
209
210
```python { .api }
211
# Resource information operations
212
def list_skus() -> ItemPaged[ResourceSku]: ... # Available SKUs
213
def list() -> ItemPaged[Quota]: ... # Usage quotas
214
def list() -> ItemPaged[ServiceOperation]: ... # Available operations
215
```
216
217
[Resource Information](./resource-information.md)
218
219
## Common Types
220
221
### Core Resource Types
222
223
```python { .api }
224
class DataMigrationService:
225
"""Azure Data Migration Service resource."""
226
def __init__(self, location: str, **kwargs): ...
227
228
# Properties
229
location: str
230
kind: str
231
sku: ServiceSku
232
provisioning_state: str
233
public_key: str
234
235
class Project:
236
"""Migration project resource."""
237
def __init__(self, location: str, source_platform: str, target_platform: str, **kwargs): ...
238
239
# Properties
240
location: str
241
source_platform: str # SQL, MySQL, PostgreSQL, MongoDb, Oracle
242
target_platform: str # SQLDB, SQLMI, AzureDbForMySql, AzureDbForPostgreSql, MongoDb
243
source_connection_info: ConnectionInfo
244
target_connection_info: ConnectionInfo
245
databases_info: List[DatabaseInfo]
246
247
class ProjectTask:
248
"""Migration or validation task."""
249
def __init__(self, properties: ProjectTaskProperties, **kwargs): ...
250
251
# Properties
252
etag: str
253
properties: ProjectTaskProperties
254
task_type: str
255
256
class ProjectTaskProperties:
257
"""Base class for task properties."""
258
# Properties
259
errors: List[ODataError]
260
state: str # Unknown, Queued, Running, Canceled, Succeeded, Failed, etc.
261
commands: List[CommandProperties]
262
client_data: Dict[str, Any]
263
```
264
265
### Connection Information Base Types
266
267
```python { .api }
268
class ConnectionInfo:
269
"""Base connection information."""
270
def __init__(self, type: str, **kwargs): ...
271
272
# Properties
273
type: str
274
user_name: str
275
password: str
276
```
277
278
### Error and Result Types
279
280
```python { .api }
281
class DataMigrationError:
282
"""Migration error information."""
283
message: str
284
type: str
285
286
class ODataError:
287
"""OData error response."""
288
code: str
289
message: str
290
target: str
291
details: List[ODataError]
292
293
class MigrationValidationResult:
294
"""Migration validation results."""
295
id: str
296
migration_id: str
297
summary_result: MigrationValidationDatabaseSummaryResult
298
status: str
299
```