0
# Project Management
1
2
Operations for managing migration projects within Data Migration services. Projects organize related migration tasks and maintain configuration for source and target database connections, serving as logical containers for migration workflows.
3
4
## Capabilities
5
6
### Create or Update Project
7
8
Creates a new migration project or updates an existing one within a Data Migration Service.
9
10
```python { .api }
11
def create_or_update(
12
group_name: str,
13
service_name: str,
14
project_name: str,
15
parameters: Project,
16
**kwargs
17
) -> Project:
18
"""
19
Creates or updates a migration project.
20
21
Parameters:
22
- group_name: Name of the resource group
23
- service_name: Name of the Data Migration Service
24
- project_name: Name of the project
25
- parameters: Project configuration and properties
26
27
Returns:
28
Project object with current state and configuration
29
"""
30
```
31
32
**Usage Example:**
33
34
```python
35
from azure.mgmt.datamigration.models import (
36
Project,
37
SqlConnectionInfo,
38
DatabaseInfo
39
)
40
41
# Configure source connection
42
source_connection = SqlConnectionInfo(
43
server_name="source-server.database.windows.net",
44
database_name="SourceDB",
45
user_name="sa",
46
password="password123",
47
authentication="SqlAuthentication",
48
encrypt_connection=True,
49
trust_server_certificate=False
50
)
51
52
# Configure target connection
53
target_connection = SqlConnectionInfo(
54
server_name="target-server.database.windows.net",
55
database_name="TargetDB",
56
user_name="targetuser",
57
password="targetpass123",
58
authentication="SqlAuthentication",
59
encrypt_connection=True,
60
trust_server_certificate=False
61
)
62
63
# Create project
64
project_params = Project(
65
location="eastus",
66
source_platform="SQL",
67
target_platform="SQLDB",
68
source_connection_info=source_connection,
69
target_connection_info=target_connection,
70
databases_info=[
71
DatabaseInfo(source_database_name="SourceDB")
72
]
73
)
74
75
project = client.projects.create_or_update(
76
group_name="myResourceGroup",
77
service_name="myMigrationService",
78
project_name="myProject",
79
parameters=project_params
80
)
81
82
print(f"Project {project.name} created successfully")
83
```
84
85
### Get Project
86
87
Retrieves details of an existing migration project.
88
89
```python { .api }
90
def get(
91
group_name: str,
92
service_name: str,
93
project_name: str,
94
**kwargs
95
) -> Project:
96
"""
97
Gets a migration project.
98
99
Parameters:
100
- group_name: Name of the resource group
101
- service_name: Name of the Data Migration Service
102
- project_name: Name of the project
103
104
Returns:
105
Project object with current configuration and state
106
"""
107
```
108
109
### Delete Project
110
111
Deletes a migration project and all associated tasks and files.
112
113
```python { .api }
114
def delete(
115
group_name: str,
116
service_name: str,
117
project_name: str,
118
delete_running_tasks: Optional[bool] = None,
119
**kwargs
120
) -> None:
121
"""
122
Deletes a migration project.
123
124
Parameters:
125
- group_name: Name of the resource group
126
- service_name: Name of the Data Migration Service
127
- project_name: Name of the project
128
- delete_running_tasks: Whether to delete running tasks
129
130
Returns:
131
None
132
"""
133
```
134
135
### Update Project
136
137
Updates properties of an existing migration project.
138
139
```python { .api }
140
def update(
141
group_name: str,
142
service_name: str,
143
project_name: str,
144
parameters: Project,
145
**kwargs
146
) -> Project:
147
"""
148
Updates a migration project.
149
150
Parameters:
151
- group_name: Name of the resource group
152
- service_name: Name of the Data Migration Service
153
- project_name: Name of the project
154
- parameters: Updated project properties
155
156
Returns:
157
Updated Project object
158
"""
159
```
160
161
### List Projects
162
163
Lists all migration projects within a Data Migration Service.
164
165
```python { .api }
166
def list(
167
group_name: str,
168
service_name: str,
169
**kwargs
170
) -> ItemPaged[Project]:
171
"""
172
Lists migration projects in a Data Migration Service.
173
174
Parameters:
175
- group_name: Name of the resource group
176
- service_name: Name of the Data Migration Service
177
178
Returns:
179
Paged collection of Project objects
180
"""
181
```
182
183
**Usage Example:**
184
185
```python
186
# List all projects in a service
187
projects = client.projects.list(
188
group_name="myResourceGroup",
189
service_name="myMigrationService"
190
)
191
192
for project in projects:
193
print(f"Project: {project.name}")
194
print(f" Source: {project.source_platform}")
195
print(f" Target: {project.target_platform}")
196
print(f" State: {project.provisioning_state}")
197
```
198
199
## Project Configuration Types
200
201
### Project
202
203
```python { .api }
204
class Project:
205
"""Migration project resource definition."""
206
207
def __init__(
208
self,
209
location: str,
210
source_platform: str,
211
target_platform: str,
212
**kwargs
213
):
214
"""
215
Initialize migration project.
216
217
Parameters:
218
- location: Azure region for the project
219
- source_platform: Source database platform
220
- target_platform: Target database platform
221
- source_connection_info: Source database connection
222
- target_connection_info: Target database connection
223
- databases_info: List of databases to migrate
224
"""
225
226
# Properties
227
location: str # Required: Azure region
228
source_platform: str # Source platform (SQL, MySQL, PostgreSQL, MongoDb, Oracle, Unknown)
229
target_platform: str # Target platform (SQLDB, SQLMI, AzureDbForMySql, AzureDbForPostgreSql, MongoDb, Unknown)
230
source_connection_info: ConnectionInfo # Source database connection
231
target_connection_info: ConnectionInfo # Target database connection
232
databases_info: List[DatabaseInfo] # Databases to migrate
233
provisioning_state: str # Current provisioning state
234
creation_time: datetime # Project creation timestamp
235
id: str # Resource ID
236
name: str # Resource name
237
type: str # Resource type
238
etag: str # Entity tag for concurrency control
239
tags: Dict[str, str] # Resource tags
240
```
241
242
### Database Configuration Types
243
244
```python { .api }
245
class DatabaseInfo:
246
"""Database information for migration."""
247
248
def __init__(self, source_database_name: str, **kwargs):
249
"""
250
Parameters:
251
- source_database_name: Name of source database
252
- target_database_name: Name of target database (optional)
253
"""
254
255
# Properties
256
source_database_name: str # Required: Source database name
257
target_database_name: str # Target database name (defaults to source name)
258
259
class DatabaseSummaryResult:
260
"""Database migration summary."""
261
262
# Properties
263
size_mb: float # Database size in MB
264
name: str # Database name
265
state: str # Migration state
266
stage: str # Migration stage
267
started_on: datetime # Migration start time
268
ended_on: datetime # Migration end time
269
message: str # Status message
270
```
271
272
## Platform Support
273
274
### Supported Source Platforms
275
276
- **SQL**: SQL Server (on-premises, Azure VM, Amazon RDS)
277
- **MySQL**: MySQL Server (on-premises, Amazon RDS, Google Cloud SQL)
278
- **PostgreSQL**: PostgreSQL Server (on-premises, Amazon RDS, Google Cloud SQL)
279
- **Oracle**: Oracle Database (on-premises, Oracle Cloud)
280
- **MongoDb**: MongoDB (on-premises, MongoDB Atlas, Amazon DocumentDB)
281
282
### Supported Target Platforms
283
284
- **SQLDB**: Azure SQL Database
285
- **SQLMI**: Azure SQL Managed Instance
286
- **AzureDbForMySql**: Azure Database for MySQL
287
- **AzureDbForPostgreSql**: Azure Database for PostgreSQL
288
- **MongoDb**: Azure Cosmos DB (MongoDB API)
289
290
### Common Platform Combinations
291
292
```python
293
# SQL Server to Azure SQL Database
294
Project(
295
source_platform="SQL",
296
target_platform="SQLDB",
297
# ... other parameters
298
)
299
300
# MySQL to Azure Database for MySQL
301
Project(
302
source_platform="MySQL",
303
target_platform="AzureDbForMySql",
304
# ... other parameters
305
)
306
307
# Oracle to Azure Database for PostgreSQL
308
Project(
309
source_platform="Oracle",
310
target_platform="AzureDbForPostgreSql",
311
# ... other parameters
312
)
313
314
# MongoDB to Azure Cosmos DB
315
Project(
316
source_platform="MongoDb",
317
target_platform="MongoDb",
318
# ... other parameters
319
)
320
```
321
322
## Error Handling
323
324
Project operations may encounter these common issues:
325
326
- **Invalid platform combinations**: Not all source/target combinations are supported
327
- **Connection validation errors**: Source or target connection information is incorrect
328
- **Resource conflicts**: Project name already exists within the service
329
- **Permission errors**: Insufficient permissions to access source or target databases
330
331
Always validate connection information before creating projects and ensure that the source and target platforms are compatible for your migration scenario.