0
# Service Management
1
2
Operations for managing Azure Data Migration Service instances, including creation, configuration, lifecycle management, and monitoring. These operations handle the fundamental service resources that host migration projects and tasks.
3
4
## Capabilities
5
6
### Create or Update Service
7
8
Creates a new Data Migration Service or updates an existing one. This is a long-running operation that provisions Azure resources.
9
10
```python { .api }
11
def begin_create_or_update(
12
group_name: str,
13
service_name: str,
14
parameters: DataMigrationService,
15
**kwargs
16
) -> LROPoller[DataMigrationService]:
17
"""
18
Creates or updates a Data Migration Service instance.
19
20
Parameters:
21
- group_name: Name of the resource group
22
- service_name: Name of the service
23
- parameters: Service configuration and properties
24
25
Returns:
26
LROPoller for the long-running operation
27
"""
28
```
29
30
**Usage Example:**
31
32
```python
33
from azure.mgmt.datamigration.models import DataMigrationService, ServiceSku
34
35
service_params = DataMigrationService(
36
location="eastus",
37
kind="vm",
38
sku=ServiceSku(
39
name="Standard_1vCore",
40
tier="Standard",
41
size="1 vCore"
42
),
43
virtual_subnet_id="/subscriptions/.../virtualNetworks/myVNet/subnets/default"
44
)
45
46
# Start the creation (long-running operation)
47
poller = client.services.begin_create_or_update(
48
group_name="myResourceGroup",
49
service_name="myMigrationService",
50
parameters=service_params
51
)
52
53
# Wait for completion
54
service = poller.result()
55
print(f"Service {service.name} created successfully")
56
```
57
58
### Get Service
59
60
Retrieves details of an existing Data Migration Service.
61
62
```python { .api }
63
def get(group_name: str, service_name: str, **kwargs) -> DataMigrationService:
64
"""
65
Gets a Data Migration Service resource.
66
67
Parameters:
68
- group_name: Name of the resource group
69
- service_name: Name of the service
70
71
Returns:
72
DataMigrationService object with current state and properties
73
"""
74
```
75
76
### Delete Service
77
78
Deletes an Data Migration Service instance and all associated resources.
79
80
```python { .api }
81
def begin_delete(group_name: str, service_name: str, **kwargs) -> LROPoller[None]:
82
"""
83
Deletes a Data Migration Service instance.
84
85
Parameters:
86
- group_name: Name of the resource group
87
- service_name: Name of the service
88
89
Returns:
90
LROPoller for the deletion operation
91
"""
92
```
93
94
### Update Service
95
96
Updates properties of an existing Data Migration Service.
97
98
```python { .api }
99
def begin_update(
100
group_name: str,
101
service_name: str,
102
parameters: DataMigrationService,
103
**kwargs
104
) -> LROPoller[DataMigrationService]:
105
"""
106
Updates a Data Migration Service instance.
107
108
Parameters:
109
- group_name: Name of the resource group
110
- service_name: Name of the service
111
- parameters: Updated service properties
112
113
Returns:
114
LROPoller for the update operation
115
"""
116
```
117
118
### Start Service
119
120
Starts a Data Migration Service that is currently stopped.
121
122
```python { .api }
123
def begin_start(group_name: str, service_name: str, **kwargs) -> LROPoller[None]:
124
"""
125
Starts a Data Migration Service.
126
127
Parameters:
128
- group_name: Name of the resource group
129
- service_name: Name of the service
130
131
Returns:
132
LROPoller for the start operation
133
"""
134
```
135
136
### Stop Service
137
138
Stops a running Data Migration Service to reduce costs.
139
140
```python { .api }
141
def begin_stop(group_name: str, service_name: str, **kwargs) -> LROPoller[None]:
142
"""
143
Stops a Data Migration Service.
144
145
Parameters:
146
- group_name: Name of the resource group
147
- service_name: Name of the service
148
149
Returns:
150
LROPoller for the stop operation
151
"""
152
```
153
154
### Check Service Status
155
156
Gets the current operational status of a Data Migration Service.
157
158
```python { .api }
159
def check_status(group_name: str, service_name: str, **kwargs) -> DataMigrationServiceStatusResponse:
160
"""
161
Gets the status of a Data Migration Service.
162
163
Parameters:
164
- group_name: Name of the resource group
165
- service_name: Name of the service
166
167
Returns:
168
Service status information including operational state
169
"""
170
```
171
172
### List Services
173
174
Lists Data Migration Services in the subscription or resource group.
175
176
```python { .api }
177
def list(**kwargs) -> ItemPaged[DataMigrationService]:
178
"""
179
Lists all Data Migration Services in the subscription.
180
181
Returns:
182
Paged collection of DataMigrationService objects
183
"""
184
185
def list_by_resource_group(group_name: str, **kwargs) -> ItemPaged[DataMigrationService]:
186
"""
187
Lists Data Migration Services in a resource group.
188
189
Parameters:
190
- group_name: Name of the resource group
191
192
Returns:
193
Paged collection of DataMigrationService objects
194
"""
195
```
196
197
### List Available SKUs
198
199
Gets available service SKUs for Data Migration Services.
200
201
```python { .api }
202
def list_skus(group_name: str, service_name: str, **kwargs) -> ItemPaged[AvailableServiceSku]:
203
"""
204
Lists available SKUs for a Data Migration Service.
205
206
Parameters:
207
- group_name: Name of the resource group
208
- service_name: Name of the service
209
210
Returns:
211
Available SKU options with capacity and cost information
212
"""
213
```
214
215
### Check Name Availability
216
217
Checks if a service name is available for use.
218
219
```python { .api }
220
def check_name_availability(
221
location: str,
222
parameters: NameAvailabilityRequest,
223
**kwargs
224
) -> NameAvailabilityResponse:
225
"""
226
Checks name availability for a Data Migration Service.
227
228
Parameters:
229
- location: Azure region
230
- parameters: Name availability request with desired name
231
232
Returns:
233
Name availability response indicating if name is available
234
"""
235
236
def check_children_name_availability(
237
group_name: str,
238
service_name: str,
239
parameters: NameAvailabilityRequest,
240
**kwargs
241
) -> NameAvailabilityResponse:
242
"""
243
Checks name availability for child resources (projects, tasks).
244
245
Parameters:
246
- group_name: Name of the resource group
247
- service_name: Name of the service
248
- parameters: Name availability request
249
250
Returns:
251
Name availability response for child resource names
252
"""
253
```
254
255
## Service Configuration Types
256
257
### DataMigrationService
258
259
```python { .api }
260
class DataMigrationService:
261
"""Azure Data Migration Service resource definition."""
262
263
def __init__(self, location: str, **kwargs):
264
"""
265
Initialize Data Migration Service.
266
267
Parameters:
268
- location: Azure region where service will be created
269
- kind: Service kind (typically "vm")
270
- sku: Service SKU configuration
271
- virtual_subnet_id: Virtual network subnet ID
272
- public_key: Public key for service authentication
273
"""
274
275
# Properties
276
location: str # Required: Azure region
277
kind: str # Service kind (e.g., "vm")
278
sku: ServiceSku # Service tier and capacity
279
provisioning_state: str # Current provisioning state
280
public_key: str # Public key for authentication
281
virtual_subnet_id: str # Virtual network subnet
282
etag: str # Entity tag for concurrency control
283
id: str # Resource ID
284
name: str # Resource name
285
type: str # Resource type
286
tags: Dict[str, str] # Resource tags
287
```
288
289
### ServiceSku
290
291
```python { .api }
292
class ServiceSku:
293
"""Service SKU configuration."""
294
295
def __init__(self, **kwargs):
296
"""Initialize service SKU."""
297
298
# Properties
299
name: str # SKU name (e.g., "Standard_1vCore")
300
tier: str # SKU tier (e.g., "Standard")
301
size: str # SKU size description
302
family: str # SKU family
303
capacity: int # SKU capacity
304
```
305
306
### Service Status Types
307
308
```python { .api }
309
class DataMigrationServiceStatusResponse:
310
"""Service status response."""
311
312
# Properties
313
agent_version: str # Version of the service agent
314
status: str # Current operational status
315
vm_size: str # Virtual machine size
316
supported_task_types: List[str] # Supported migration task types
317
318
class NameAvailabilityRequest:
319
"""Name availability check request."""
320
321
def __init__(self, name: str, type: str, **kwargs):
322
"""
323
Parameters:
324
- name: Desired resource name
325
- type: Resource type to check
326
"""
327
328
# Properties
329
name: str # Name to check
330
type: str # Resource type
331
332
class NameAvailabilityResponse:
333
"""Name availability check response."""
334
335
# Properties
336
name_available: bool # Whether name is available
337
reason: str # Reason if unavailable
338
message: str # Detailed message
339
```
340
341
## Error Handling
342
343
Service operations may raise these common exceptions:
344
345
- `ResourceExistsError`: Service name already exists
346
- `ResourceNotFoundError`: Service or resource group not found
347
- `ClientAuthenticationError`: Authentication failed
348
- `HttpResponseError`: Other HTTP errors with detailed error information
349
350
Always handle long-running operations properly by checking the poller status and handling potential failures during provisioning operations.