Skip to content

Commit f1fc68d

Browse files
committed
further info and examples
1 parent 0a4e546 commit f1fc68d

File tree

2 files changed

+57
-31
lines changed

2 files changed

+57
-31
lines changed

articles/batch/batch-custom-images.md

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@ ms.date: 05/18/2020
77

88
# Use a managed image to create a pool of virtual machines
99

10-
To create a custom image for your Batch pool's virtual machines (VMs), you can use either the [Shared Image Gallery](batch-sig-images.md), or a *managed image* resource.
10+
To create a custom image for your Batch pool's virtual machines (VMs), you can use the [Shared Image Gallery](batch-sig-images.md). We also provide a way to create a custom image with a *managed image* resource.
1111

12-
> [!TIP]
12+
> [!IMPORTANT]
1313
> In most cases, you should create custom images using the Shared Image Gallery. By using the Shared Image Gallery, you can provision pools faster, scale larger quantities of VMs, and have improved reliability when provisioning VMs. To learn more, see [Use the Shared Image Gallery to create a custom pool](batch-sig-images.md).
1414
1515
## Prerequisites
1616

17-
- **A managed image resource**. To create a pool of virtual machines using a custom image, you need to have or create a managed image resource in the same Azure subscription and region as the Batch account. The image should be created from snapshots of the VM's OS disk and optionally its attached data disks. For more information and steps to prepare a managed image, see the following section.
17+
- **A managed image resource**. To create a pool of virtual machines using a custom image, you need to have or create a managed image resource in the same Azure subscription and region as the Batch account. The image should be created from snapshots of the VM's OS disk and optionally its attached data disks.
1818
- Use a unique custom image for each pool you create.
1919
- To create a pool with the image using the Batch APIs, specify the **resource ID** of the image, which is of the form `/subscriptions/xxxx-xxxxxx-xxxxx-xxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/myImage`.
2020
- The managed image resource should exist for the lifetime of the pool to allow scale-up and can be removed after the pool is deleted.
2121

22-
- **Azure Active Directory (AAD) authentication**. The Batch client API must use AAD authentication. Azure Batch support for AAD is documented in [Authenticate Batch service solutions with Active Directory](batch-aad-auth.md).
22+
- **Azure Active Directory (Azure AD) authentication**. The Batch client API must use Azure AD authentication. Azure Batch support for Azure AD is documented in [Authenticate Batch service solutions with Active Directory](batch-aad-auth.md).
2323

2424
## Prepare a custom image
2525

@@ -36,9 +36,7 @@ To scale Batch pools reliably with a custom image, we recommend creating a manag
3636
If you are creating a new VM for the image, use a first party Azure Marketplace image supported by Batch as the base image for your managed image. Only first party images can be used as a base image. To get a full list of Azure Marketplace image references supported by Azure Batch, see the [List node agent SKUs](/java/api/com.microsoft.azure.batch.protocol.accounts.listnodeagentskus) operation.
3737

3838
> [!NOTE]
39-
> You can't use a third-party image that has additional license and purchase terms as your base image. For information about these Marketplace images, see the guidance for [Linux](../virtual-machines/linux/cli-ps-findimage.md#deploy-an-image-with-marketplace-terms
40-
) or [Windows](../virtual-machines/windows/cli-ps-findimage.md#deploy-an-image-with-marketplace-terms
41-
) VMs.
39+
> You can't use a third-party image that has additional license and purchase terms as your base image. For information about these Marketplace images, see the guidance for [Linux](../virtual-machines/linux/cli-ps-findimage.md#deploy-an-image-with-marketplace-terms) or [Windows](../virtual-machines/windows/cli-ps-findimage.md#deploy-an-image-with-marketplace-terms) VMs.
4240
4341
- Ensure the VM is created with a managed disk. This is the default storage setting when you create a VM.
4442
- Do not install Azure extensions, such as the Custom Script extension, on the VM. If the image contains a pre-installed extension, Azure may encounter problems when deploying the Batch pool.
@@ -54,7 +52,7 @@ A snapshot is a full, read-only copy of a VHD. To create a snapshot of a VM's OS
5452

5553
To create a managed image from a snapshot, use Azure command-line tools such as the [az image create](/cli/azure/image) command. You can create an image by specifying an OS disk snapshot and optionally one or more data disk snapshots.
5654

57-
## Create a pool from a Shared Image using C#
55+
## Create a pool from a custom image
5856

5957
Once you have saved your custom image and you know its resource ID or name, create a Batch pool from that image. The following steps show you how to create a pool from a Shared Image using the C# SDK.
6058

@@ -63,6 +61,8 @@ Once you have saved your custom image and you know its resource ID or name, crea
6361
>
6462
> The resource for the managed image must exist for the lifetime of the pool. If the underlying resource is deleted, the pool cannot be scaled.
6563
64+
### C#
65+
6666
```csharp
6767
private static VirtualMachineConfiguration CreateVirtualMachineConfiguration(ImageReference imageReference)
6868
{
@@ -91,6 +91,32 @@ private static void CreateBatchPool(BatchClient batchClient, VirtualMachineConfi
9191
}
9292
```
9393

94+
### REST API
95+
96+
REST API URI
97+
98+
```http
99+
PUT https://management.azure.com/subscriptions/{sub id}/resourceGroups/{resource group name}/providers/Microsoft.Batch/batchAccounts/{account name}/pools/{pool name}?api-version=2020-03-01
100+
```
101+
102+
Request Body
103+
104+
```json
105+
{
106+
"properties": {
107+
"vmSize": "{VM size}",
108+
"deploymentConfiguration": {
109+
"virtualMachineConfiguration": {
110+
"imageReference": {
111+
"id": "/subscriptions/{sub id}/resourceGroups/{resource group name}/providers/Microsoft.Compute/images/{image name}"
112+
},
113+
"nodeAgentSkuId": "{Node Agent SKU ID}"
114+
}
115+
}
116+
}
117+
}
118+
```
119+
94120
## Considerations for large pools
95121

96122
If you plan to create a pool with hundreds of VMs or more using a custom image, it is important to follow the preceding guidance to use an image created from a VM snapshot.
@@ -121,4 +147,5 @@ For more information on using Packer to create a VM, see [Build a Linux image wi
121147

122148
## Next steps
123149

150+
- Learn how to use the [Shared Image Gallery](batch-sig-images.md) to create a custom pool.
124151
- For an in-depth overview of Batch, see [Batch service workflow and resources](batch-service-workflow-features.md).

articles/batch/batch-sig-images.md

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,22 @@ Using a Shared Image saves time in preparing your pool's compute nodes to run yo
1919

2020
Using a Shared Image configured for your scenario can provide several advantages:
2121

22-
* **Use the same images across the regions.** You can create Shared Image replicas across different regions so all your pools utilize the same image.
23-
* **Configure the operating system (OS).** You can customize the configuration of the image's operating system disk.
24-
* **Pre-install applications.** Pre-installing applications on the OS disk is more efficient and less error-prone than installing applications after provisioning the compute nodes with a start task.
25-
* **Copy large amounts of data once.** Make static data part of the managed Shared Image by copying it to a managed image's data disks. This only needs to be done once and makes data available to each node of the pool.
26-
* **Grow pools to larger sizes.** With the Shared Image Gallery, you can create larger pools with your customized images along with more Shared Image replicas.
27-
* **Better performance than custom image.** Using Shared Images, the time it takes for the pool to reach the steady state is up to 25% faster, and the VM idle latency is up to 30% shorter.
28-
* **Image versioning and grouping for easier management.** The image grouping definition contains information about why the image was created, what OS it is for, and information about using the image. Grouping images allows for easier image management. For more information, see [Image definitions](../virtual-machines/windows/shared-image-galleries.md#image-definitions).
22+
- **Use the same images across the regions.** You can create Shared Image replicas across different regions so all your pools utilize the same image.
23+
- **Configure the operating system (OS).** You can customize the configuration of the image's operating system disk.
24+
- **Pre-install applications.** Pre-installing applications on the OS disk is more efficient and less error-prone than installing applications after provisioning the compute nodes with a start task.
25+
- **Copy large amounts of data once.** Make static data part of the managed Shared Image by copying it to a managed image's data disks. This only needs to be done once and makes data available to each node of the pool.
26+
- **Grow pools to larger sizes.** With the Shared Image Gallery, you can create larger pools with your customized images along with more Shared Image replicas.
27+
- **Better performance than custom image.** Using Shared Images, the time it takes for the pool to reach the steady state is up to 25% faster, and the VM idle latency is up to 30% shorter.
28+
- **Image versioning and grouping for easier management.** The image grouping definition contains information about why the image was created, what OS it is for, and information about using the image. Grouping images allows for easier image management. For more information, see [Image definitions](../virtual-machines/windows/shared-image-galleries.md#image-definitions).
2929

3030
## Prerequisites
3131

3232
> [!NOTE]
3333
> You need to authenticate using Azure AD. If you use shared-key-auth, you will get an authentication error.
3434
35-
* **An Azure Batch account.** To create a Batch account, see the Batch quickstarts using the [Azure portal](quick-create-portal.md) or [Azure CLI](quick-create-cli.md).
35+
- **An Azure Batch account.** To create a Batch account, see the Batch quickstarts using the [Azure portal](quick-create-portal.md) or [Azure CLI](quick-create-cli.md).
3636

37-
* **A Shared Image Gallery image**. To create a Shared Image, you need to have or create a managed image resource. The image should be created from snapshots of the VM's OS disk and optionally its attached data disks. For more information, see [Prepare a managed image](#prepare-a-managed-image).
37+
- **A Shared Image Gallery image**. To create a Shared Image, you need to have or create a managed image resource. The image should be created from snapshots of the VM's OS disk and optionally its attached data disks. For more information, see [Prepare a managed image](#prepare-a-managed-image).
3838

3939
> [!NOTE]
4040
> Your Shared Image must be in the same subscription as the Batch account. Your Shared Image can be in different regions as long as it has replicas in the same region as your Batch account.
@@ -43,9 +43,9 @@ Using a Shared Image configured for your scenario can provide several advantages
4343

4444
In Azure, you can prepare a managed image from:
4545

46-
* Snapshots of an Azure VM's OS and data disks
47-
* A generalized Azure VM with managed disks
48-
* A generalized on-premises VHD uploaded to the cloud
46+
- Snapshots of an Azure VM's OS and data disks
47+
- A generalized Azure VM with managed disks
48+
- A generalized on-premises VHD uploaded to the cloud
4949

5050
> [!NOTE]
5151
> Currently, Batch only supports generalized custom images. You can't create a custom image from a specialized image at this time.
@@ -57,15 +57,13 @@ To scale Batch pools reliably with a custom image, we recommend creating a manag
5757
If you are creating a new VM for the image, use a first party Azure Marketplace image supported by Batch as the base image for your managed image. Only first party images can be used as a base image. To get a full list of Azure Marketplace image references supported by Azure Batch, see the [List node agent SKUs](/java/api/com.microsoft.azure.batch.protocol.accounts.listnodeagentskus) operation.
5858

5959
> [!NOTE]
60-
> You can't use a third-party image that has additional license and purchase terms as your base image. For information about these Marketplace images, see the guidance for [Linux](../virtual-machines/linux/cli-ps-findimage.md#deploy-an-image-with-marketplace-terms
61-
) or [Windows](../virtual-machines/windows/cli-ps-findimage.md#deploy-an-image-with-marketplace-terms
62-
) VMs.
60+
> You can't use a third-party image that has additional license and purchase terms as your base image. For information about these Marketplace images, see the guidance for [Linux](../virtual-machines/linux/cli-ps-findimage.md#deploy-an-image-with-marketplace-terms) or [Windows](../virtual-machines/windows/cli-ps-findimage.md#deploy-an-image-with-marketplace-terms) VMs.
6361
64-
* Ensure the VM is created with a managed disk. This is the default storage setting when you create a VM.
65-
* Do not install Azure extensions, such as the Custom Script extension, on the VM. If the image contains a pre-installed extension, Azure may encounter problems when deploying the Batch pool.
66-
* When using attached data disks, you need to mount and format the disks from within a VM to use them.
67-
* Ensure that the base OS image you provide uses the default temp drive. The Batch node agent currently expects the default temp drive.
68-
* Once the VM is running, connect to it via RDP (for Windows) or SSH (for Linux). Install any necessary software or copy desired data.
62+
- Ensure the VM is created with a managed disk. This is the default storage setting when you create a VM.
63+
- Do not install Azure extensions, such as the Custom Script extension, on the VM. If the image contains a pre-installed extension, Azure may encounter problems when deploying the Batch pool.
64+
- When using attached data disks, you need to mount and format the disks from within a VM to use them.
65+
- Ensure that the base OS image you provide uses the default temp drive. The Batch node agent currently expects the default temp drive.
66+
- Once the VM is running, connect to it via RDP (for Windows) or SSH (for Linux). Install any necessary software or copy desired data.
6967

7068
### Create a VM snapshot
7169

@@ -210,10 +208,11 @@ Use the following steps to create a pool from a Shared Image in the Azure portal
210208

211209
If you plan to create a pool with hundreds or thousands of VMs or more using a Shared Image, use the following guidance.
212210

213-
* **Shared Image Gallery replica numbers.** For every pool with up to 600 instances, we recommend you keep at least one replica. For example, if you are creating a pool with 3000 VMs, you should keep at least 5 replicas of your image. We always suggest keeping more replicas than minimum requirements for better performance.
211+
- **Shared Image Gallery replica numbers.** For every pool with up to 600 instances, we recommend you keep at least one replica. For example, if you are creating a pool with 3000 VMs, you should keep at least 5 replicas of your image. We always suggest keeping more replicas than minimum requirements for better performance.
214212

215-
* **Resize timeout.** If your pool contains a fixed number of nodes (if it doesn't autoscale), increase the `resizeTimeout` property of the pool depending on the pool size. For every 1000 VMs, the recommended resize timeout is at least 15 minutes. For example, the recommended resize timeout for a pool with 2000 VMs is at least 30 minutes.
213+
- **Resize timeout.** If your pool contains a fixed number of nodes (if it doesn't autoscale), increase the `resizeTimeout` property of the pool depending on the pool size. For every 1000 VMs, the recommended resize timeout is at least 15 minutes. For example, the recommended resize timeout for a pool with 2000 VMs is at least 30 minutes.
216214

217215
## Next steps
218216

219-
* For an in-depth overview of Batch, see [Batch service workflow and resources](batch-service-workflow-features.md).
217+
- For an in-depth overview of Batch, see [Batch service workflow and resources](batch-service-workflow-features.md).
218+
- Learn about the [Shared Image Gallery](../virtual-machines/windows/shared-image-galleries.md).

0 commit comments

Comments
 (0)