|
2 | 2 | title: Create a pool across availability zones
|
3 | 3 | description: Learn how to create a Batch pool with zonal policy to help protect against failures.
|
4 | 4 | ms.topic: how-to
|
5 |
| -ms.date: 05/25/2023 |
| 5 | +ms.date: 08/12/2024 |
6 | 6 | ms.devlang: csharp
|
7 | 7 | ms.custom:
|
8 | 8 | ---
|
@@ -33,10 +33,47 @@ The following examples show how to create a Batch pool across Availability Zones
|
33 | 33 | ### Batch Management Client .NET SDK
|
34 | 34 |
|
35 | 35 | ```csharp
|
36 |
| -pool.DeploymentConfiguration.VirtualMachineConfiguration.NodePlacementConfiguration = new NodePlacementConfiguration() |
| 36 | +var credential = new DefaultAzureCredential(); |
| 37 | +ArmClient _armClient = new ArmClient(credential); |
| 38 | + |
| 39 | +var batchAccountIdentifier = ResourceIdentifier.Parse("your-batch-account-resource-id"); |
| 40 | + |
| 41 | +BatchAccountResource batchAccount = _armClient.GetBatchAccountResource(batchAccountIdentifier); |
| 42 | + |
| 43 | +var poolName = "pool2"; |
| 44 | +var imageReference = new BatchImageReference() |
| 45 | +{ |
| 46 | + Publisher = "canonical", |
| 47 | + Offer = "0001-com-ubuntu-server-jammy", |
| 48 | + Sku = "22_04-lts", |
| 49 | + Version = "latest" |
| 50 | +}; |
| 51 | +string nodeAgentSku = "batch.node.ubuntu 22.04"; |
| 52 | + |
| 53 | +var batchAccountPoolData = new BatchAccountPoolData() |
| 54 | +{ |
| 55 | + VmSize = "Standard_DS1_v2", |
| 56 | + DeploymentConfiguration = new BatchDeploymentConfiguration() |
37 | 57 | {
|
38 |
| - Policy = NodePlacementPolicyType.Zonal |
39 |
| - }; |
| 58 | + VmConfiguration = new BatchVmConfiguration(imageReference, nodeAgentSku) |
| 59 | + { |
| 60 | + NodePlacementPolicy = BatchNodePlacementPolicyType.Zonal, |
| 61 | + }, |
| 62 | + }, |
| 63 | + ScaleSettings = new BatchAccountPoolScaleSettings() |
| 64 | + { |
| 65 | + FixedScale = new BatchAccountFixedScaleSettings() |
| 66 | + { |
| 67 | + TargetDedicatedNodes = 5, |
| 68 | + ResizeTimeout = TimeSpan.FromMinutes(15), |
| 69 | + } |
| 70 | + }, |
| 71 | + |
| 72 | +}; |
| 73 | + |
| 74 | +ArmOperation<BatchAccountPoolResource> armOperation = batchAccount.GetBatchAccountPools().CreateOrUpdate( |
| 75 | + WaitUntil.Completed, poolName, batchAccountPoolData); |
| 76 | +BatchAccountPoolResource pool = armOperation.Value; |
40 | 77 |
|
41 | 78 | ```
|
42 | 79 |
|
|
0 commit comments