0
# Batch Account Management
1
2
Comprehensive lifecycle management of Azure Batch accounts including creation, configuration, key management, network security settings, and monitoring.
3
4
## Capabilities
5
6
### Account Creation
7
8
Creates a new Azure Batch account with specified configuration including auto-storage, identity, encryption, and network settings.
9
10
```python { .api }
11
def begin_create(
12
resource_group_name: str,
13
account_name: str,
14
parameters: Union[BatchAccountCreateParameters, IO[bytes]],
15
**kwargs: Any
16
) -> LROPoller[BatchAccount]:
17
"""
18
Creates a new Batch account with the specified parameters.
19
20
Args:
21
resource_group_name (str): The name of the resource group
22
account_name (str): The name of the Batch account
23
parameters (Union[BatchAccountCreateParameters, IO[bytes]]): Account creation parameters
24
25
Returns:
26
LROPoller[BatchAccount]: Long-running operation poller for the created account
27
"""
28
```
29
30
### Account Retrieval
31
32
Retrieves detailed information about an existing Batch account.
33
34
```python { .api }
35
def get(
36
resource_group_name: str,
37
account_name: str,
38
**kwargs: Any
39
) -> BatchAccount:
40
"""
41
Gets information about the specified Batch account.
42
43
Args:
44
resource_group_name (str): The name of the resource group
45
account_name (str): The name of the Batch account
46
47
Returns:
48
BatchAccount: The Batch account details
49
"""
50
```
51
52
### Account Updates
53
54
Updates an existing Batch account's configuration including tags, auto-storage, identity, and encryption settings.
55
56
```python { .api }
57
def update(
58
resource_group_name: str,
59
account_name: str,
60
parameters: Union[BatchAccountUpdateParameters, IO[bytes]],
61
**kwargs: Any
62
) -> BatchAccount:
63
"""
64
Updates a Batch account with the specified parameters.
65
66
Args:
67
resource_group_name (str): The name of the resource group
68
account_name (str): The name of the Batch account
69
parameters (BatchAccountUpdateParameters): Account update parameters
70
71
Returns:
72
BatchAccount: The updated Batch account
73
"""
74
```
75
76
### Account Deletion
77
78
Deletes a Batch account and all associated resources.
79
80
```python { .api }
81
def begin_delete(
82
resource_group_name: str,
83
account_name: str,
84
**kwargs: Any
85
) -> LROPoller[None]:
86
"""
87
Deletes the specified Batch account.
88
89
Args:
90
resource_group_name (str): The name of the resource group
91
account_name (str): The name of the Batch account
92
93
Returns:
94
LROPoller[None]: Long-running operation poller for the deletion
95
"""
96
```
97
98
### Account Listing
99
100
Lists Batch accounts within resource groups or across the entire subscription.
101
102
```python { .api }
103
def list_by_resource_group(
104
resource_group_name: str,
105
**kwargs: Any
106
) -> ItemPaged[BatchAccount]:
107
"""
108
Gets information about Batch accounts within the specified resource group.
109
110
Args:
111
resource_group_name (str): The name of the resource group
112
113
Returns:
114
ItemPaged[BatchAccount]: Paginated list of Batch accounts
115
"""
116
117
def list(**kwargs: Any) -> ItemPaged[BatchAccount]:
118
"""
119
Gets information about Batch accounts within the subscription.
120
121
Returns:
122
ItemPaged[BatchAccount]: Paginated list of Batch accounts
123
"""
124
```
125
126
### Key Management
127
128
Manages access keys for authenticating with the Batch account.
129
130
```python { .api }
131
def get_keys(
132
resource_group_name: str,
133
account_name: str,
134
**kwargs: Any
135
) -> BatchAccountKeys:
136
"""
137
Gets the account keys for the specified Batch account.
138
139
Args:
140
resource_group_name (str): The name of the resource group
141
account_name (str): The name of the Batch account
142
143
Returns:
144
BatchAccountKeys: The account keys
145
"""
146
147
def regenerate_key(
148
resource_group_name: str,
149
account_name: str,
150
parameters: BatchAccountRegenerateKeyParameters,
151
**kwargs: Any
152
) -> BatchAccountKeys:
153
"""
154
Regenerates the specified account key for the Batch account.
155
156
Args:
157
resource_group_name (str): The name of the resource group
158
account_name (str): The name of the Batch account
159
parameters (BatchAccountRegenerateKeyParameters): Regeneration parameters
160
161
Returns:
162
BatchAccountKeys: The new account keys
163
"""
164
```
165
166
### Storage Integration
167
168
Manages auto-storage account synchronization for seamless integration with Azure Storage.
169
170
```python { .api }
171
def synchronize_auto_storage_keys(
172
resource_group_name: str,
173
account_name: str,
174
**kwargs: Any
175
) -> None:
176
"""
177
Synchronizes access keys for the auto-storage account configured for the Batch account.
178
179
Args:
180
resource_group_name (str): The name of the resource group
181
account_name (str): The name of the Batch account
182
"""
183
```
184
185
### Detector Management
186
187
Gets information about available detectors for monitoring and diagnostics.
188
189
```python { .api }
190
def list_detectors(
191
resource_group_name: str,
192
account_name: str,
193
**kwargs: Any
194
) -> ItemPaged[DetectorResponse]:
195
"""
196
Gets information about the detectors available for a given Batch account.
197
198
Args:
199
resource_group_name (str): The name of the resource group
200
account_name (str): The name of the Batch account
201
202
Returns:
203
ItemPaged[DetectorResponse]: Paginated list of available detectors
204
"""
205
```
206
207
```python { .api }
208
def get_detector(
209
resource_group_name: str,
210
account_name: str,
211
detector_id: str,
212
**kwargs: Any
213
) -> DetectorResponse:
214
"""
215
Gets information about the given detector for a given Batch account.
216
217
Args:
218
resource_group_name (str): The name of the resource group
219
account_name (str): The name of the Batch account
220
detector_id (str): The name of the detector
221
222
Returns:
223
DetectorResponse: Information about the specified detector
224
"""
225
```
226
227
### Network Dependencies
228
229
Retrieves outbound network dependency endpoints for network configuration and firewall setup.
230
231
```python { .api }
232
def list_outbound_network_dependencies_endpoints(
233
resource_group_name: str,
234
account_name: str,
235
**kwargs: Any
236
) -> ItemPaged[OutboundEnvironmentEndpoint]:
237
"""
238
Gets the list of outbound network dependency endpoints for the Batch account.
239
240
Args:
241
resource_group_name (str): The name of the resource group
242
account_name (str): The name of the Batch account
243
244
Returns:
245
ItemPaged[OutboundEnvironmentEndpoint]: Network dependency endpoints
246
"""
247
```
248
249
## Types
250
251
### Account Configuration Types
252
253
```python { .api }
254
class BatchAccountCreateParameters:
255
location: str
256
tags: dict
257
identity: BatchAccountIdentity
258
auto_storage: AutoStorageBaseProperties
259
pool_allocation_mode: PoolAllocationMode
260
public_network_access: PublicNetworkAccessType
261
network_profile: NetworkProfile
262
encryption: EncryptionProperties
263
264
class BatchAccountUpdateParameters:
265
tags: dict
266
identity: BatchAccountIdentity
267
auto_storage: AutoStorageProperties
268
encryption: EncryptionProperties
269
public_network_access: PublicNetworkAccessType
270
network_profile: NetworkProfile
271
272
class BatchAccountIdentity:
273
type: ResourceIdentityType
274
user_assigned_identities: dict
275
principal_id: str
276
tenant_id: str
277
278
class AutoStorageProperties:
279
storage_account_id: str
280
authentication_mode: AutoStorageAuthenticationMode
281
node_identity_reference: ComputeNodeIdentityReference
282
last_key_sync: datetime
283
284
class NetworkProfile:
285
account_access: EndpointAccessProfile
286
node_management_access: EndpointAccessProfile
287
288
class EncryptionProperties:
289
key_source: KeySource
290
key_vault_properties: KeyVaultProperties
291
```
292
293
### Account Information Types
294
295
```python { .api }
296
class BatchAccount:
297
id: str
298
name: str
299
type: str
300
location: str
301
tags: dict
302
identity: BatchAccountIdentity
303
provisioning_state: ProvisioningState
304
account_endpoint: str
305
node_management_endpoint: str
306
auto_storage: AutoStorageProperties
307
encryption: EncryptionProperties
308
dedicated_core_quota: int
309
low_priority_core_quota: int
310
dedicated_core_quota_per_vm_family: list
311
pool_allocation_mode: PoolAllocationMode
312
public_network_access: PublicNetworkAccessType
313
network_profile: NetworkProfile
314
315
class BatchAccountKeys:
316
account_name: str
317
primary: str
318
secondary: str
319
320
class BatchAccountRegenerateKeyParameters:
321
key_name: AccountKeyType
322
323
class DetectorResponse:
324
id: str
325
name: str
326
type: str
327
properties: dict
328
```
329
330
## Usage Examples
331
332
### Creating a Batch Account with Auto-Storage
333
334
```python
335
from azure.mgmt.batch.models import (
336
BatchAccountCreateParameters,
337
AutoStorageBaseProperties,
338
PoolAllocationMode,
339
PublicNetworkAccessType
340
)
341
342
# Configure auto-storage
343
auto_storage = AutoStorageBaseProperties(
344
storage_account_id="/subscriptions/.../storageAccounts/mystorageaccount"
345
)
346
347
# Create account parameters
348
account_params = BatchAccountCreateParameters(
349
location="East US",
350
auto_storage=auto_storage,
351
pool_allocation_mode=PoolAllocationMode.BATCH_SERVICE,
352
public_network_access=PublicNetworkAccessType.ENABLED
353
)
354
355
# Create the account
356
operation = client.batch_account.create(
357
"my-resource-group",
358
"my-batch-account",
359
account_params
360
)
361
account = operation.result()
362
print(f"Created account: {account.name}")
363
```
364
365
### Managing Account Keys
366
367
```python
368
# Get current keys
369
keys = client.batch_account.get_keys("my-resource-group", "my-batch-account")
370
print(f"Primary key: {keys.primary}")
371
372
# Regenerate primary key
373
from azure.mgmt.batch.models import BatchAccountRegenerateKeyParameters, AccountKeyType
374
375
regen_params = BatchAccountRegenerateKeyParameters(key_name=AccountKeyType.PRIMARY)
376
new_keys = client.batch_account.regenerate_key(
377
"my-resource-group",
378
"my-batch-account",
379
regen_params
380
)
381
print(f"New primary key: {new_keys.primary}")
382
```