You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/virtual-machines/capture-image-resource.md
+61-31Lines changed: 61 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,53 +1,53 @@
1
1
---
2
-
title: Create a managed image in Azure
2
+
title: Create a legacy managed image in Azure
3
3
description: Create a legacy managed image of a generalized VM or VHD in Azure.
4
4
author: cynthn
5
5
ms.service: virtual-machines
6
6
ms.subservice: imaging
7
7
ms.workload: infrastructure-services
8
8
ms.topic: how-to
9
-
ms.date: 02/28/2023
9
+
ms.date: 03/15/2023
10
10
ms.author: cynthn
11
11
ms.custom: legacy
12
12
13
13
---
14
-
# Create a managed image of a generalized VM in Azure
14
+
# Create a legacy managed image of a generalized VM in Azure
15
15
16
16
**Applies to:**:heavy_check_mark: Linux VMs :heavy_check_mark: Windows VMs :heavy_check_mark: Flexible scale sets
17
17
18
-
19
-
This article covers the older managed image technology. For the most current technology, customers are encouraged to use [Azure Compute Gallery](azure-compute-gallery.md). All new features, like ARM64, Trusted Launch, and Confidential VM are only supported through Azure Compute Gallery. If you have an existing managed image, you can use it as a source and create an Azure Compute Gallery image. For more information, see [Create an image definition and image version](image-version.md).
20
-
21
-
One managed image supports up to 20 simultaneous deployments. Attempting to create more than 20 VMs concurrently, from the same managed image, may result in provisioning timeouts due to the storage performance limitations of a single VHD. To create more than 20 VMs concurrently, use an [Azure Compute Gallery](shared-image-galleries.md) (formerly known as Shared Image Gallery) image configured with 1 replica for every 20 concurrent VM deployments.
18
+
> [!IMPORTANT]
19
+
> This article covers the older managed image technology. For the most current technology, customers are encouraged to use [Azure Compute Gallery](azure-compute-gallery.md). All new features, like ARM64, Trusted Launch, and Confidential VM are only supported through Azure Compute Gallery. If you have an existing managed image, you can use it as a source and create an Azure Compute Gallery image. For more information, see [Create an image definition and image version](image-version.md).
20
+
>
21
+
> One managed image supports up to 20 simultaneous deployments. Attempting to create more than 20 VMs concurrently, from the same managed image, may result in provisioning timeouts due to the storage performance limitations of a single VHD. To create more than 20 VMs concurrently, use an [Azure Compute Gallery](shared-image-galleries.md) (formerly known as Shared Image Gallery) image configured with 1 replica for every 20 concurrent VM deployments.
22
22
23
23
For information on how managed images are billed, see [Managed Disks pricing](https://azure.microsoft.com/pricing/details/managed-disks/).
24
24
25
25
## Prerequisites
26
26
27
27
You need a [generalized](generalize.md) VM in order to create an image.
28
28
29
-
## Create a managed image from a VM using the portal
30
-
31
-
1. Go to the [Azure portal](https://portal.azure.com). Search for and select **Virtual machines**.
32
-
33
-
2. Select your VM from the list.
34
-
35
-
3. In the **Virtual machine** page for the VM, on the upper menu, select **Capture**. The **Create an image** page appears.
36
-
4. For **Share image to Azure compute gallery**, select **No, capture only a managed image.**
37
-
5. For **Resource Group**, you can either create the image in the same resource group as the VM or select another resource group in your subscription.
38
29
39
-
4. For **Name**, either accept the pre-populated name or type your own name for the image.
30
+
## CLI: Create a legacy managed image of a VM
40
31
41
-
6. If you want to delete the source VM after the image has been created, select **Automatically delete this virtual machine after creating the image**.
42
-
7.7. If you want the ability to use the image in any [availability zone](../availability-zones/az-overview.md), select **On** for **Zone resiliency**.
43
-
44
-
8. Select **Create** to create the image.
45
-
46
-
After the image is created, you can find it as an **Image** resource in the list of resources in the resource group.
32
+
Create a managed image of the VM with [az image create](/cli/azure/image#az-image-create). The following example creates an image named *myImage* in the resource group named *myResourceGroup* using the VM resource named *myVM*.
47
33
34
+
```azurecli
35
+
az image create \
36
+
--resource-group myResourceGroup \
37
+
--name myImage --source myVM
38
+
```
39
+
40
+
> [!NOTE]
41
+
> The image is created in the same resource group as your source VM. You can create VMs in any resource group within your subscription from this image. From a management perspective, you may wish to create a specific resource group for your VM resources and images.
42
+
>
43
+
> If you are capturing an image of a generation 2 VM, also use the `--hyper-v-generation V2` parameter. for more information, see [Generation 2 VMs](generation-2.md).
44
+
>
45
+
> If you would like to store your image in zone-resilient storage, you need to create it in a region that supports [availability zones](../availability-zones/az-overview.md) and include the `--zone-resilient true` parameter.
46
+
47
+
This command returns JSON that describes the VM image. Save this output for later reference.
48
48
49
49
50
-
## Create a managed image of a VM using PowerShell
50
+
## PowerShell: Create a legacy managed image of a VM
51
51
52
52
Creating an image directly from the VM ensures that the image includes all of the disks associated with the VM, including the OS disk and any data disks. This example shows how to create a managed image from a VM that uses managed disks.
53
53
@@ -96,7 +96,7 @@ To create a VM image, follow these steps:
## Create an image from a managed disk using PowerShell
99
+
## PowerShell: Create a legacy managed image from a managed disk
100
100
101
101
If you want to create an image of only the OS disk, specify the managed disk ID as the OS disk:
102
102
@@ -136,7 +136,7 @@ If you want to create an image of only the OS disk, specify the managed disk ID
136
136
```
137
137
138
138
139
-
## Create a managed image from a snapshot using PowerShell
139
+
## PowerShell: Create a legacy managed image from a snapshot
140
140
141
141
You can create a managed image from a snapshot of a generalized VM by following these steps:
142
142
@@ -169,7 +169,7 @@ You can create a managed image from a snapshot of a generalized VM by following
169
169
```
170
170
171
171
172
-
## Create a managed image from a VM that uses a storage account
172
+
## PowerShell: Create a legacy managed image from a VM that uses a storage account
173
173
174
174
To create a managed image from a VM that doesn't use managed disks, you need the URI of the OS VHD in the storage account, in the following format: https://*mystorageaccount*.blob.core.windows.net/*vhdcontainer*/*vhdfilename.vhd*. In this example, the VHD is in *mystorageaccount*, in a container named *vhdcontainer*, and the VHD filename is *vhdfilename.vhd*.
175
175
@@ -203,11 +203,41 @@ To create a managed image from a VM that doesn't use managed disks, you need the
203
203
```
204
204
205
205
206
-
## Create a VM from a managed image
206
+
## CLI: Create a VM from a legacy managed image
207
+
Create a VM by using the image you created with [az vm create](/cli/azure/vm). The following example creates a VM named *myVMDeployed* from the image named *myImage*.
208
+
209
+
```azurecli
210
+
az vm create \
211
+
--resource-group myResourceGroup \
212
+
--name myVMDeployed \
213
+
--image myImage\
214
+
--admin-username azureuser \
215
+
--ssh-key-value ~/.ssh/id_rsa.pub
216
+
```
217
+
218
+
## CLI: Create a VM in another resource group from a legacy managed image
219
+
220
+
You can create VMs from an image in any resource group within your subscription. To create a VM in a different resource group than the image, specify the full resource ID to your image. Use [az image list](/cli/azure/image#az-image-list) to view a list of images. The output is similar to the following example.
The following example uses [az vm create](/cli/azure/vm#az-vm-create) to create a VM in a resource group other than the source image, by specifying the image resource ID.
One managed image supports up to 20 simultaneous deployments. Attempting to create more than 20 VMs concurrently, from the same managed image, may result in provisioning timeouts due to the storage performance limitations of a single VHD. To create more than 20 VMs concurrently, use an [Azure Compute Gallery](shared-image-galleries.md) (formerly known as Shared Image Gallery) image configured with 1 replica for every 20 concurrent VM deployments.
209
239
210
-
### Portal
240
+
## Portal: Create a VM from a legacy managed image
211
241
212
242
1. Go to the [Azure portal](https://portal.azure.com) to find a managed image. Search for and select **Images**.
213
243
3. Select the image you want to use from the list. The image **Overview** page opens.
@@ -218,7 +248,7 @@ One managed image supports up to 20 simultaneous deployments. Attempting to crea
218
248
8. On the summary page, you should see your image name listed as a **Private image**. Select **Ok** to start the virtual machine deployment.
219
249
220
250
221
-
### PowerShell
251
+
## PowerShell: Create a VM from a legacy managed image
222
252
223
253
You can use PowerShell to create a VM from an image by using the simplified parameter set for the [New-AzVm](/powershell/module/az.compute/new-azvm) cmdlet. The image needs to be in the same resource group where you'll create the VM.
0 commit comments