Skip to content

Commit cd08a38

Browse files
authored
Merge pull request #268534 from AjKundnani/main
Created new document for migrating managed image to compute gallery
2 parents c75522e + b756a46 commit cd08a38

File tree

4 files changed

+112
-1
lines changed

4 files changed

+112
-1
lines changed

articles/virtual-machines/TOC.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,8 @@
547547
- name: Export an image to a managed disk
548548
href: managed-disk-from-image-version.md
549549
desplayName: export, image version, disk, SIG, gallery
550+
- name: Migrate Managed image to Compute gallery
551+
href: migration-managed-image-to-compute-gallery.md
550552
- name: Purchase plan information
551553
href: marketplace-images.md
552554
- name: Deprecated images FAQ

articles/virtual-machines/capture-image-resource.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ ms.custom: legacy, devx-track-azurepowershell
1414
**Applies to:** :heavy_check_mark: Linux VMs :heavy_check_mark: Windows VMs :heavy_check_mark: Flexible scale sets
1515

1616
> [!IMPORTANT]
17-
> 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).
17+
> 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 [Migrate managed image to Azure compute gallery](migration-managed-image-to-compute-gallery.md).
1818
>
1919
> Once you mark a VM as `generalized` in Azure, you cannot restart the VM.
2020
>
55.9 KB
Loading
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
---
2+
title: Migrate Managed image to Compute gallery
3+
description: Learn how to legacy Managed image to image version in Azure compute gallery.
4+
author: AjKundnani
5+
ms.service: virtual-machines
6+
ms.subservice: gallery
7+
ms.topic: how-to
8+
ms.date: 03/09/2024
9+
ms.author: ajkundna
10+
ms.reviewer: cynthn
11+
ms.custom: template-how-to, devx-track-azurepowershell
12+
---
13+
14+
# Migrate Managed image to Azure compute gallery image version
15+
16+
**Applies to:** :heavy_check_mark: Linux Virtual Machine :heavy_check_mark: Windows Virtual Machine :heavy_check_mark: Virtual Machine Flex Scale Sets
17+
18+
[Managed images](capture-image-resource.md) is legacy method to generalize and capture Virtual Machine image. 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 Virtual Machine 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.
19+
20+
## Before you begin
21+
22+
- [Create an Azure Compute Gallery](create-gallery.md).
23+
- Assign `Reader` permission on source managed image.
24+
- Assign `Contributor` permission on target Azure compute gallery image definition.
25+
26+
## Migrate Managed image to Azure Compute Gallery image
27+
28+
### [Portal](#tab/portal)
29+
30+
This section steps through using the Azure portal to migrate Managed image to existing Azure Compute Gallery.
31+
32+
1. Sign-in to [Azure portal](https://portal.azure.com).
33+
2. Navigate to `Managed image` to be migrated and select **Clone to a VM image**.
34+
35+
:::image type="content" source="./media/shared-image-galleries/01-click-clone-image.png" alt-text="Screenshot of the Managed image to be migrated":::
36+
37+
3. Provide following details on the `Create VM image version` page and select **Next : Replication >**:
38+
- Version number
39+
- Target Azure compute gallery
40+
- Target Virtual Machine image definition
41+
42+
4. Select following `Replication` configuration or select default values and select **Next : Encryption >**:
43+
- Default storage sku
44+
- Default replication count
45+
- Target replication regions
46+
47+
5. Select `SSE encryption type` or select default `Encryption at-rest with a platform managed key` and select **Next : Tags >**.
48+
6. *Optional* Assign resource tags.
49+
7. Validate the configuration on `Review + Create` page and select **Create** to complete the migration.
50+
51+
### [CLI](#tab/cli)
52+
53+
You need the `tenantID` of the source image, the `subscriptionID` for the Azure compute gallery (target), and the `resourceID` of the source image.
54+
55+
```azurecli
56+
# Set some variables
57+
tenantID="<tenant ID for the source image>"
58+
subID="<subscription ID where the image will be creted>"
59+
sourceImageID="<resource ID of the source managed image>"
60+
61+
# Login to the subscription where the new image will be created
62+
az login
63+
64+
# Log in to the tenant where the source image is available
65+
az login --tenant $tenantID
66+
67+
# Log back in to the subscription where the image will be created and ensure subscription context is set
68+
az login
69+
az account set --subscription $subID
70+
71+
# Create the image
72+
az sig image-version create `
73+
--gallery-image-definition myImageDef `
74+
--gallery-image-version 1.0.0 `
75+
--gallery-name myGallery `
76+
--resource-group myResourceGroup `
77+
--image-version $sourceImageID
78+
```
79+
80+
### [PowerShell](#tab/powershell)
81+
82+
You need the `tenantID` of the source image, the `subscriptionID` for the Azure compute gallery (target), and the `resourceID` of the source image.
83+
84+
```azurepowershell
85+
# Set variables
86+
$targetSubID = "<subscription ID for the target>"
87+
$sourceTenantID = "<tenant ID where for the source image>"
88+
$sourceImageID = "<resource ID of the source image>"
89+
90+
# Login to the tenant where the source image is published
91+
Connect-AzAccount -Tenant $sourceTenantID -UseDeviceAuthentication
92+
93+
# Login to the subscription where the new image will be created and set the context
94+
Connect-AzAccount -UseDeviceAuthentication -Subscription $targetSubID
95+
Set-AzContext -Subscription $targetSubID
96+
97+
# Create the image version from another image version in a different tenant
98+
New-AzGalleryImageVersion `
99+
-ResourceGroupName myResourceGroup `
100+
-GalleryName myGallery `
101+
-GalleryImageDefinitionName myImageDef `
102+
-Location "West US 2" `
103+
-Name 1.0.0 `
104+
-SourceImageId $sourceImageID
105+
```
106+
107+
## Next steps
108+
109+
Replace managed image reference with Azure compute gallery image version in the Virtual machine and flex scale sets deployment templates.

0 commit comments

Comments
 (0)