CINXE.COM
Create a legacy managed image in Azure - Azure Virtual Machines | Microsoft Learn
<!DOCTYPE html><html class="hasSidebar hasPageActions hasBreadcrumb has-default-focus theme-light" lang="en-us" dir="ltr" data-authenticated="false" data-auth-status-determined="false" data-target="docs" x-ms-format-detection="none"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta property="og:title" content="Create a legacy managed image in Azure - Azure Virtual Machines" /> <meta property="og:type" content="website" /> <meta property="og:url" content="https://learn.microsoft.com/en-us/azure/virtual-machines/capture-image-resource" /><meta property="og:description" content="Create a legacy managed image of a generalized VM or VHD in Azure." /><meta property="og:image" content="https://learn.microsoft.com/en-us/media/open-graph-image.png" /> <meta property="og:image:alt" content="Microsoft Learn" /> <meta name="twitter:card" content="summary_large_image" /> <meta name="twitter:site" content="@MicrosoftLearn" /> <meta name="color-scheme" content="light dark"><meta name="author" content="ju-shim" /> <meta name="breadcrumb_path" content="../breadcrumb/azure-compute/toc.json" /> <meta name="depot_name" content="Learn.azure-compute" /> <meta name="description" content="Create a legacy managed image of a generalized VM or VHD in Azure." /> <meta name="document_id" content="2ae81530-fe57-633f-7546-fa86b600976a" /> <meta name="document_version_independent_id" content="27ab0818-bb67-b461-8c3b-0ff9dc8f410f" /> <meta name="feedback_help_link_type" content="get-help-at-qna" /> <meta name="feedback_help_link_url" content="https://learn.microsoft.com/answers/tags/94/azure-virtual-machines/" /> <meta name="feedback_product_url" content="https://feedback.azure.com/d365community/forum/79b1327d-d925-ec11-b6e6-000d3a4f06a4" /> <meta name="feedback_system" content="Standard" /> <meta name="git_commit_id" content="17a939c293ef86e12b4f3260284de2a20fd693bc" /> <meta name="gitcommit" content="https://github.com/MicrosoftDocs/azure-compute-docs-pr/blob/17a939c293ef86e12b4f3260284de2a20fd693bc/articles/virtual-machines/capture-image-resource.yml" /> <meta name="locale" content="en-us" /> <meta name="ms.author" content="jushiman" /> <meta name="ms.custom" content="legacy" /> <meta name="ms.custom" content="devx-track-azurepowershell" /> <meta name="ms.custom" content="ge-structured-content-pilot" /> <meta name="ms.date" content="06/25/2024" /> <meta name="ms.service" content="azure-virtual-machines" /> <meta name="ms.subservice" content="imaging" /> <meta name="ms.suite" content="office" /> <meta name="ms.topic" content="how-to" /> <meta name="original_content_git_url" content="https://github.com/MicrosoftDocs/azure-compute-docs-pr/blob/live/articles/virtual-machines/capture-image-resource.yml" /> <meta name="page_type" content="HowTo" /> <meta name="permissioned-type" content="public" /> <meta name="recommendation_types" content="Training" /> <meta name="recommendation_types" content="Certification" /> <meta name="recommendations" content="true" /> <meta name="schema" content="HowTo" /> <meta name="site_name" content="Docs" /> <meta name="toc_rel" content="toc.json" /> <meta name="uhfHeaderId" content="azure" /> <meta name="updated_at" content="2024-11-21 05:32 AM" /> <meta name="persistent_id" content="a714db7e-eb2b-b9bd-756e-457dd6b92c83" /> <meta name="scope" content="Azure, Virtual Machines" /><meta name="github_feedback_content_git_url" content="https://github.com/MicrosoftDocs/azure-compute-docs/blob/main/articles/virtual-machines/capture-image-resource.yml" /><link href="https://learn.microsoft.com/en-us/azure/virtual-machines/capture-image-resource" rel="canonical"><title>Create a legacy managed image in Azure - Azure Virtual Machines | Microsoft Learn</title><link rel="stylesheet" href="/static/assets/0.4.028726178/styles/site-ltr.css"> <script id="msdocs-script"> var msDocs = {environment: { supportLevel: 'production', accessLevel: 'online', reviewFeatures: false, systemContent: true, azurePortalHostname: 'portal.azure.com', legacyHosting: false, siteName: 'learn', },data: { timeOrigin: Date.now(), contentLocale: 'en-us', contentDir: 'ltr', userLocale: 'en-us', userDir: 'ltr', pageTemplate: 'HowTo', brand: 'azure', context: {}, hasBinaryRating: true, feedbackHelpLinkType:'get-help-at-qna', feedbackHelpLinkUrl:'https://learn.microsoft.com/answers/tags/94/azure-virtual-machines/', standardFeedback: true, showFeedbackReport: false, enableTutorialFeedback: false, feedbackSystem: 'Standard', feedbackGitHubRepo: 'MicrosoftDocs/azure-docs', feedbackProductUrl: 'https://feedback.azure.com/d365community/forum/79b1327d-d925-ec11-b6e6-000d3a4f06a4',extendBreadcrumb: false,isEditDisplayable: true, hideViewSource: false, hasPageActions: true, hasPrintButton: true, hasBookmark: true, hasShare: true, isPermissioned: false, isPrivateUnauthorized: false,hasRecommendations: false,contributors: [{ name: "ju-shim", url: "https://github.com/ju-shim" },{ name: "johndowns", url: "https://github.com/johndowns" },{ name: "rwestMSFT", url: "https://github.com/rwestMSFT" },{ name: "Taojunshen", url: "https://github.com/Taojunshen" },{ name: "mattbriggs", url: "https://github.com/mattbriggs" }],}, functions:{} }; </script><script src="https://wcpstatic.microsoft.com/mscc/lib/v2/wcp-consent.js"></script> <script src="https://js.monitor.azure.com/scripts/c/ms.jsll-4.min.js"></script><script src="/static/assets/0.4.028726178/global/deprecation.js"></script><script src="/static/assets/0.4.028726178/scripts/en-us/index-docs.js"></script></head> <body lang="en-us" dir="ltr"> <div class="header-holder has-default-focus"> <a href="#main" style="z-index: 1070" class="outline-color-text visually-hidden-until-focused position-fixed inner-focus focus-visible top-0 left-0 right-0 padding-xs text-align-center has-body-background" tabindex="1">Skip to main content</a><div hidden id="cookie-consent-holder" data-test-id="cookie-consent-container"></div> <div id="unsupported-browser" style=" background-color: white; color: black; padding: 16px; border-bottom: 1px solid grey;" hidden > <div style="max-width: 800px; margin: 0 auto;"> <p style="font-size: 24px">This browser is no longer supported.</p> <p style="font-size: 16px; margin-top: 16px;">Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.</p> <div style="margin-top: 12px;"> <a href="https://go.microsoft.com/fwlink/p/?LinkID=2092881 " style=" background-color: #0078d4; border: 1px solid #0078d4; color: white; padding: 6px 12px; border-radius: 2px; display: inline-block; ">Download Microsoft Edge</a> <a href="https://learn.microsoft.com/en-us/lifecycle/faq/internet-explorer-microsoft-edge" style=" background-color: white; padding: 6px 12px; border: 1px solid #505050; color: #171717; border-radius: 2px; display: inline-block; ">More info about Internet Explorer and Microsoft Edge</a> </div> </div> </div> <!-- liquid-tag banners global --> <!-- site header --> <header id="ms--site-header" data-test-id="site-header-wrapper" role="banner" itemscope="itemscope" itemtype="http://schema.org/Organization"> <div id="ms--mobile-nav" class="site-header display-none-tablet padding-inline-none gap-none" data-bi-name="mobile-header" data-test-id="mobile-header"></div> <div id="ms--primary-nav" class="site-header display-none display-flex-tablet" data-bi-name="L1-header" data-test-id="primary-header"></div> <div id="ms--secondary-nav" class="site-header display-none display-flex-tablet" data-bi-name="L2-header" data-test-id="secondary-header"></div> </header><div id="content-header" class="content-header uhf-container has-padding has-default-focus border-bottom-none" data-bi-name="content-header"> <div class="content-header-controls margin-xxs margin-inline-sm-tablet"> <button type="button" class="contents-button button button-sm margin-right-xxs" data-bi-name="contents-expand" aria-haspopup="true" data-contents-button> <span class="icon"><span class="docon docon-menu" aria-hidden="true"></span></span> <span class="contents-expand-title">Table of contents</span> </button> <button type="button" class="ap-collapse-behavior ap-expanded button button-sm" data-bi-name="ap-collapse" aria-controls="action-panel"> <span class="icon"><span class="docon docon-exit-mode" aria-hidden="true"></span></span> <span>Exit focus mode</span> </button> </div> </div><div id="disclaimer-holder" class="has-overflow-hidden has-default-focus"> <!-- liquid-tag banners sectional --> </div> </div> <div class="mainContainer uhf-container has-default-focus" data-bi-name="body"> <div class="columns has-large-gaps is-gapless-mobile "><div id="left-container" class="left-container is-hidden-mobile column is-one-third-tablet is-one-quarter-desktop"> <nav id="affixed-left-container" class="margin-top-sm-tablet position-sticky display-flex flex-direction-column" aria-label="Primary"></nav> </div><!-- .primary-holder --> <section class="primary-holder column is-two-thirds-tablet is-three-quarters-desktop"> <!--div.columns --> <div class="columns is-gapless-mobile has-large-gaps "><div id="main-column" class="column is-full is-8-desktop"> <main id="main" class="" role="main" data-bi-name="content" lang="en-us" dir="ltr"><!-- article-header --> <div id="article-header" class="background-color-body margin-top-sm-tablet margin-bottom-xs display-none-print"> <div class="display-flex align-items-center "><details id="article-header-breadcrumbs-overflow-popover" class="popover" data-for="article-header-breadcrumbs"> <summary class="button button-clear button-primary button-sm inner-focus" aria-label="All breadcrumbs"> <span class="icon"> <span class="docon docon-more"></span> </span> </summary> <div id="article-header-breadcrumbs-overflow" class="popover-content padding-none"> </div> </details> <bread-crumbs id="article-header-breadcrumbs" data-test-id="article-header-breadcrumbs" class="overflow-hidden flex-grow-1 margin-right-sm margin-right-md-tablet margin-right-lg-desktop margin-left-negative-xxs padding-left-xxs"></bread-crumbs><div id="article-header-page-actions" class="opacity-none margin-left-auto display-flex flex-wrap-no-wrap align-items-stretch"><a id="lang-link-tablet" class="button button-primary button-clear button-sm display-none display-inline-flex-tablet" title="Read in English" data-bi-name="language-toggle" data-read-in-link hidden> <span class="icon margin-none" aria-hidden="true" data-read-in-link-icon> <span class="docon docon-locale-globe"></span> </span> <span class="is-visually-hidden" data-read-in-link-text>Read in English</span> </a><button type="button" class="collection button button-clear button-sm button-primary display-none display-inline-flex-tablet" data-list-type="collection" data-bi-name="collection" title="Add to collection"> <span class="icon margin-none" aria-hidden="true"> <span class="docon docon-circle-addition"></span> </span> <span class="collection-status is-visually-hidden">Save</span> </button><a data-contenteditbtn class="button button-clear button-sm text-decoration-none button-primary display-none display-inline-flex-tablet" aria-label="Edit" title="Edit This Document" data-bi-name="edit" href="https://github.com/MicrosoftDocs/azure-compute-docs/blob/main/articles/virtual-machines/capture-image-resource.yml" data-original_content_git_url="https://github.com/MicrosoftDocs/azure-compute-docs-pr/blob/live/articles/virtual-machines/capture-image-resource.yml" data-original_content_git_url_template="{repo}/blob/{branch}/articles/virtual-machines/capture-image-resource.yml" data-pr_repo="" data-pr_branch=""> <span class="icon margin-none" aria-hidden="true"> <span class="docon docon-edit-outline"></span> </span> </a> <details class="popover popover-right" id="article-header-page-actions-overflow"> <summary class="justify-content-flex-start button button-clear button-sm button-primary" aria-label="More actions" title="More actions"> <span class="icon" aria-hidden="true"> <span class="docon docon-more-vertical"></span> </span> </summary> <div class="popover-content padding-xs"><button data-page-action-item="overflow-mobile" type="button" class="justify-content-flex-start button-block button-sm has-inner-focus button button-clear display-none-tablet" data-bi-name="contents-expand" data-contents-button data-popover-close> <span class="icon"> <span class="docon docon-editor-list-bullet" aria-hidden="true"></span> </span><span class="contents-expand-title">Table of contents</span></button><a id="lang-link-overflow" class="justify-content-flex-start button-sm has-inner-focus button button-clear button-block display-none-tablet" title="Read in English" data-bi-name="language-toggle" data-page-action-item="overflow-mobile" data-check-hidden="true" data-read-in-link hidden > <span class="icon" aria-hidden="true" data-read-in-link-icon> <span class="docon docon-locale-globe"></span> </span> <span data-read-in-link-text>Read in English</span> </a><button type="button" class="collection justify-content-flex-start button button-clear button-sm has-inner-focus button-block display-none-tablet" data-list-type="collection" data-bi-name="collection" title="Save" data-page-action-item="overflow-mobile" data-check-hidden="true" data-popover-close> <span class="icon" aria-hidden="true"> <span class="docon docon-circle-addition"></span> </span> <span class="collection-status">Save</span> </button> <button type="button" class="collection justify-content-flex-start button button-clear button-sm has-inner-focus button-block display-none-tablet" data-list-type="plan" data-bi-name="plan" title="Add to Plan" data-page-action-item="overflow-mobile" data-check-hidden="true" data-popover-close hidden> <span class="icon" aria-hidden="true"> <span class="docon docon-circle-addition"></span> </span> <span class="plan-status">Add to Plan</span> </button><a data-contenteditbtn class="button button-clear button-block button-sm has-inner-focus justify-content-flex-start text-decoration-none display-none-tablet" aria-label="Edit" title="Edit This Document" data-bi-name="edit" href="https://github.com/MicrosoftDocs/azure-compute-docs/blob/main/articles/virtual-machines/capture-image-resource.yml" data-original_content_git_url="https://github.com/MicrosoftDocs/azure-compute-docs-pr/blob/live/articles/virtual-machines/capture-image-resource.yml" data-original_content_git_url_template="{repo}/blob/{branch}/articles/virtual-machines/capture-image-resource.yml" data-pr_repo="" data-pr_branch=""> <span class="icon" aria-hidden="true"> <span class="docon docon-edit-outline"></span> </span> <span>Edit</span> </a><div aria-hidden="true" class="margin-none" data-page-action-item="overflow-all"></div> <hr class="display-none-tablet margin-bottom-xxs margin-top-xxs" /> <h4 class="font-size-sm padding-left-xxs">Share via</h4> <a class="button button-clear button-sm button-block has-inner-focus text-decoration-none justify-content-flex-start share-facebook" data-bi-name="facebook" data-page-action-item="overflow-all"> <span class="icon" aria-hidden="true"> <span class="docon docon-facebook-share font-size-md color-primary"></span> </span> <span class="margin-left-xxs">Facebook</span> </a> <a class="button button-clear button-sm has-inner-focus button-block text-decoration-none justify-content-flex-start share-twitter" data-bi-name="twitter" data-page-action-item="overflow-all"> <span class="icon" aria-hidden="true"> <span class="docon docon-xlogo-share font-size-xxs"></span> </span> <span class="margin-left-xxs">x.com</span> </a> <a class="button button-clear button-sm has-inner-focus button-block text-decoration-none justify-content-flex-start share-linkedin" data-bi-name="linkedin" data-page-action-item="overflow-all"> <span class="icon" aria-hidden="true"> <span class="docon docon-linked-in-logo font-size-sm color-primary"></span> </span> <span class="margin-left-xxs">LinkedIn</span> </a> <a class="button button-clear button-sm button-block has-inner-focus text-decoration-none justify-content-flex-start margin-bottom-xxs share-email" data-bi-name="email" data-page-action-item="overflow-all"> <span class="icon" aria-hidden="true"> <span class="docon docon-mail-message font-size-sm color-primary"></span> </span> <span class="margin-left-xxs">Email</span> </a><hr /> <button class="button button-block button-clear button-sm justify-content-flex-start has-inner-focus margin-top-xxs" title="Print" type="button" aria-label="Print" data-bi-name="print" data-page-action-item="overflow-all" data-popover-close data-print-page data-check-hidden="true"> <span class="icon" aria-hidden="true"> <span class="docon docon-print font-size-sm color-primary"></span> </span> <span class="margin-left-xxs">Print</span> </button> </div> </details> </div></div> </div> <!-- end article-header --><div> <button type="button" class="border contents-button button button-clear button-sm is-hidden-tablet has-inner-focus" data-bi-name="contents-expand" data-contents-button hidden> <span class="icon"> <span class="docon docon-editor-list-bullet" aria-hidden="true"></span> </span><span class="contents-expand-title">Table of contents</span></button> </div><!-- end mobile-contents button --> <div class=""><h1 class="title font-size-h1 margin-bottom-none">Create a legacy managed image of a generalized VM in Azure </h1><div class="display-flex justify-content-space-between align-items-center flex-wrap-wrap page-metadata-container"> <div class="margin-right-xxs"> <ul class="metadata page-metadata" data-bi-name="page info" lang="en-us" dir="ltr"><li>How-to</li><li class="visibility-hidden-visual-diff"><time class="is-invisible" data-article-date aria-label="Article review date" datetime="2024-11-21T05:32:00Z" data-article-date-source="git">11/21/2024</time> </li><li class="contributors-holder display-none-print"> <button aria-label="View all contributors" class="contributors-button link-button" data-bi-name="contributors" title="View all contributors">5 contributors</button> </li></ul> </div> <div id="user-feedback" class="margin-block-xxs display-none-print" data-hide-on-archived> <button id="user-feedback-button" data-test-id="conceptual-feedback-button" class="button button-sm button-clear button-primary" type="button" data-bi-name="user-feedback-button" data-user-feedback-button > <span class="icon" aria-hidden="true"> <span class="docon docon-like"></span> </span> <span>Feedback</span> </button> </div></div><nav id="center-doc-outline" class="doc-outline is-hidden-desktop display-none-print margin-bottom-sm" data-bi-name="intopic toc" aria-label="In this article"> <h2 id="ms--in-this-article" class="title is-6 margin-block-xs">In this article</h2> </nav><!-- <content> --><div id="ms--how-to-container" class="background-color-body-background is-full-height"> <div id="how-to-introduction" class="content"><div class="IMPORTANT"> <p>Important</p> <p>This article covers the older managed image technology. For the most current technology, customers are encouraged to use <a href="azure-compute-gallery" data-linktype="relative-path">Azure Compute Gallery</a>. 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 <a href="image-version" data-linktype="relative-path">Create an image definition and image version</a>.</p> <p>Once you mark a VM as <code>generalized</code> in Azure, you cannot restart the VM.</p> <p>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 <a href="shared-image-galleries" data-linktype="relative-path">Azure Compute Gallery</a> (formerly known as Shared Image Gallery) image configured with 1 replica for every 20 concurrent VM deployments.</p> </div> <p>For information on how managed images are billed, see <a href="https://azure.microsoft.com/pricing/details/managed-disks/" data-linktype="external">Managed Disks pricing</a>.</p> </div> <section id="ms--how-to-prerequisites-section" class="anchor-headings"> <h2 id="prerequisites" class="title font-size-h2 margin-top-sm margin-bottom-xs">Prerequisites</h2> <div class="content"> <ul> <li><p>You need a <a href="generalize" data-linktype="relative-path">generalized</a> VM in order to create an image.</p> </li> </ul> </div> </section> <section id="ms--how-to-procedure-section" class="anchor-headings"> <h2 id="cli-create-a-legacy-managed-image-of-a-vm" class="title font-size-h2 margin-top-sm margin-bottom-xs">CLI: Create a legacy managed image of a VM </h2> <div class="content"><p>Create a managed image of the VM with <a href="/en-us/cli/azure/image#az-image-create" data-linktype="absolute-path">az image create</a>. The following example creates an image named <em>myImage</em> in the resource group named <em>myResourceGroup</em> using the VM resource named <em>myVM</em>.</p> </div> <div class="code-section content"><pre><code class="lang-azurecli">az image create \ --resource-group myResourceGroup \ --name myImage --source myVM </code></pre> <div class="NOTE"> <p>Note</p> <p>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.</p> <p>If you are capturing an image of a generation 2 VM, also use the <code>--hyper-v-generation V2</code> parameter. for more information, see <a href="generation-2" data-linktype="relative-path">Generation 2 VMs</a>.</p> <p>If you would like to store your image in zone-resilient storage, you need to create it in a region that supports <a href="/en-us/azure/reliability/availability-zones-overview" data-linktype="absolute-path">availability zones</a> and include the <code>--zone-resilient true</code> parameter.</p> </div> <p>This command returns JSON that describes the VM image. Save this output for later reference.</p> </div> </section> <section id="ms--how-to-procedure-section" class="anchor-headings"> <h2 id="powershell-create-a-legacy-managed-image-of-a-vm" class="title font-size-h2 margin-top-sm margin-bottom-xs">PowerShell: Create a legacy managed image of a VM </h2> <div class="content"><p>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.</p> <p>Before you begin, make sure that you have the latest version of the Azure PowerShell module. To find the version, run <code>Get-Module -ListAvailable Az</code> in PowerShell. If you need to upgrade, see <a href="/en-us/powershell/azure/install-azure-powershell" data-linktype="absolute-path">Install Azure PowerShell on Windows with PowerShellGet</a>. If you are running PowerShell locally, run <code>Connect-AzAccount</code> to create a connection with Azure.</p> <div class="NOTE"> <p>Note</p> <p>If you would like to store your image in zone-redundant storage, you need to create it in a region that supports <a href="/en-us/azure/reliability/availability-zones-region-support" data-linktype="absolute-path">availability zones</a> and include the <code>-ZoneResilient</code> parameter in the image configuration (<code>New-AzImageConfig</code> command).</p> </div> <p>To create a VM image, follow these steps:</p> </div> <div class="content"> <ol> <li><p>Create some variables.</p> <pre><code class="lang-azurepowershell" data-interactive="azurepowershell">$vmName = "myVM" $rgName = "myResourceGroup" $location = "EastUS" $imageName = "myImage" </code></pre> </li> <li><p>Make sure the VM has been deallocated.</p> <pre><code class="lang-azurepowershell" data-interactive="azurepowershell">Stop-AzVM -ResourceGroupName $rgName -Name $vmName -Force </code></pre> </li> <li><p>Set the status of the virtual machine to <strong>Generalized</strong>.</p> <pre><code class="lang-azurepowershell" data-interactive="azurepowershell">Set-AzVm -ResourceGroupName $rgName -Name $vmName -Generalized </code></pre> </li> <li><p>Get the virtual machine.</p> <pre><code class="lang-azurepowershell" data-interactive="azurepowershell">$vm = Get-AzVM -Name $vmName -ResourceGroupName $rgName </code></pre> </li> <li><p>Create the image configuration.</p> <pre><code class="lang-azurepowershell" data-interactive="azurepowershell">$image = New-AzImageConfig -Location $location -SourceVirtualMachineId $vm.Id </code></pre> </li> <li><p>Create the image.</p> <pre><code class="lang-azurepowershell" data-interactive="azurepowershell">New-AzImage -ImageName $imageName -ResourceGroupName $rgName -Image $imageConfig </code></pre> </li> </ol> </div> </section> <section id="ms--how-to-procedure-section" class="anchor-headings"> <h2 id="powershell-create-a-legacy-managed-image-from-a-managed-disk" class="title font-size-h2 margin-top-sm margin-bottom-xs">PowerShell: Create a legacy managed image from a managed disk </h2> <div class="content"><p>If you want to create an image of only the OS disk, specify the managed disk ID as the OS disk:</p> </div> <div class="content"> <ol> <li><p>Create some variables.</p> <pre><code class="lang-azurepowershell" data-interactive="azurepowershell">$vmName = "myVM" $rgName = "myResourceGroup" $location = "EastUS" $imageName = "myImage" </code></pre> </li> <li><p>Get the VM.</p> <pre><code class="lang-azurepowershell" data-interactive="azurepowershell">$vm = Get-AzVm -Name $vmName -ResourceGroupName $rgName </code></pre> </li> <li><p>Get the ID of the managed disk.</p> <pre><code class="lang-azurepowershell" data-interactive="azurepowershell">$diskID = $vm.StorageProfile.OsDisk.ManagedDisk.Id </code></pre> </li> <li><p>Create the image configuration.</p> <pre><code class="lang-azurepowershell" data-interactive="azurepowershell">$imageConfig = New-AzImageConfig -Location $location $imageConfig = Set-AzImageOsDisk -Image $imageConfig -OsState Generalized -OsType Windows -ManagedDiskId $diskID </code></pre> </li> <li><p>Create the image.</p> <pre><code class="lang-azurepowershell" data-interactive="azurepowershell">New-AzImage -ImageName $imageName -ResourceGroupName $rgName -Image $imageConfig </code></pre> </li> </ol> </div> </section> <section id="ms--how-to-procedure-section" class="anchor-headings"> <h2 id="powershell-create-a-legacy-managed-image-from-a-snapshot" class="title font-size-h2 margin-top-sm margin-bottom-xs">PowerShell: Create a legacy managed image from a snapshot </h2> <div class="content"><p>You can create a managed image from a snapshot of a generalized VM by following these steps:</p> </div> <div class="content"> <ol> <li><p>Create some variables.</p> <pre><code class="lang-azurepowershell" data-interactive="azurepowershell">$rgName = "myResourceGroup" $location = "EastUS" $snapshotName = "mySnapshot" $imageName = "myImage" </code></pre> </li> <li><p>Get the snapshot.</p> <pre><code class="lang-azurepowershell" data-interactive="azurepowershell">$snapshot = Get-AzSnapshot -ResourceGroupName $rgName -SnapshotName $snapshotName </code></pre> </li> <li><p>Create the image configuration.</p> <pre><code class="lang-azurepowershell" data-interactive="azurepowershell">$imageConfig = New-AzImageConfig -Location $location $imageConfig = Set-AzImageOsDisk -Image $imageConfig -OsState Generalized -OsType Windows -SnapshotId $snapshot.Id </code></pre> </li> <li><p>Create the image.</p> <pre><code class="lang-azurepowershell" data-interactive="azurepowershell">New-AzImage -ImageName $imageName -ResourceGroupName $rgName -Image $imageConfig </code></pre> </li> </ol> </div> </section> <section id="ms--how-to-procedure-section" class="anchor-headings"> <h2 id="powershell-create-a-legacy-managed-image-from-a-vm-that-uses-a-storage-account" class="title font-size-h2 margin-top-sm margin-bottom-xs">PowerShell: Create a legacy managed image from a VM that uses a storage account </h2> <div class="content"><p>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://<em>mystorageaccount</em>.blob.core.windows.net/<em>vhdcontainer</em>/<em>vhdfilename.vhd</em>. In this example, the VHD is in <em>mystorageaccount</em>, in a container named <em>vhdcontainer</em>, and the VHD filename is <em>vhdfilename.vhd</em>.</p> </div> <div class="content"> <ol> <li><p>Create some variables.</p> <pre><code class="lang-azurepowershell" data-interactive="azurepowershell">$vmName = "myVM" $rgName = "myResourceGroup" $location = "EastUS" $imageName = "myImage" $osVhdUri = "https://mystorageaccount.blob.core.windows.net/vhdcontainer/vhdfilename.vhd" </code></pre> </li> <li><p>Stop/deallocate the VM.</p> <pre><code class="lang-azurepowershell" data-interactive="azurepowershell">Stop-AzVM -ResourceGroupName $rgName -Name $vmName -Force </code></pre> </li> <li><p>Mark the VM as generalized.</p> <pre><code class="lang-azurepowershell" data-interactive="azurepowershell">Set-AzVm -ResourceGroupName $rgName -Name $vmName -Generalized </code></pre> </li> <li><p>Create the image by using your generalized OS VHD.</p> <pre><code class="lang-azurepowershell" data-interactive="azurepowershell">$imageConfig = New-AzImageConfig -Location $location $imageConfig = Set-AzImageOsDisk -Image $imageConfig -OsType Windows -OsState Generalized -BlobUri $osVhdUri $image = New-AzImage -ImageName $imageName -ResourceGroupName $rgName -Image $imageConfig </code></pre> </li> </ol> </div> </section> <section id="ms--how-to-procedure-section" class="anchor-headings"> <h2 id="cli-create-a-vm-from-a-legacy-managed-image" class="title font-size-h2 margin-top-sm margin-bottom-xs">CLI: Create a VM from a legacy managed image </h2> <div class="content"><p>Create a VM by using the image you created with <a href="/en-us/cli/azure/vm" data-linktype="absolute-path">az vm create</a>. The following example creates a VM named <em>myVMDeployed</em> from the image named <em>myImage</em>.</p> </div> <div class="code-section content"><pre><code class="lang-azurecli">az vm create \ --resource-group myResourceGroup \ --name myVMDeployed \ --image myImage\ --admin-username azureuser \ --ssh-key-value ~/.ssh/id_rsa.pub </code></pre> </div> </section> <section id="ms--how-to-procedure-section" class="anchor-headings"> <h2 id="cli-create-a-vm-in-another-resource-group-from-a-legacy-managed-image" class="title font-size-h2 margin-top-sm margin-bottom-xs">CLI: Create a VM in another resource group from a legacy managed image </h2> <div class="content"><p>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 <a href="/en-us/cli/azure/image#az-image-list" data-linktype="absolute-path">az image list</a> to view a list of images. The output is similar to the following example.</p> <pre><code class="lang-json">"id": "/subscriptions/guid/resourceGroups/MYRESOURCEGROUP/providers/Microsoft.Compute/images/myImage", "location": "westus", "name": "myImage", </code></pre> <p>The following example uses <a href="/en-us/cli/azure/vm#az-vm-create" data-linktype="absolute-path">az vm create</a> to create a VM in a resource group other than the source image, by specifying the image resource ID.</p> </div> <div class="code-section content"><pre><code class="lang-azurecli">az vm create \ --resource-group myOtherResourceGroup \ --name myOtherVMDeployed \ --image "/subscriptions/guid/resourceGroups/MYRESOURCEGROUP/providers/Microsoft.Compute/images/myImage" \ --admin-username azureuser \ --ssh-key-value ~/.ssh/id_rsa.pub </code></pre> </div> </section> <section id="ms--how-to-procedure-section" class="anchor-headings"> <h2 id="portal-create-a-vm-from-a-legacy-managed-image" class="title font-size-h2 margin-top-sm margin-bottom-xs">Portal: Create a VM from a legacy managed image </h2> <div class="content"><p>Create a VM in Azure: Find image in portal, choose 'Create VM', fill in details, select size, adjust settings, and deploy.</p> </div> <div class="content"> <ol> <li><p>Go to the <a href="https://portal.azure.com" data-linktype="external">Azure portal</a> to find a managed image. Search for and select <strong>Images</strong>.</p> </li> <li><p>Select the image you want to use from the list. The image <strong>Overview</strong> page opens.</p> </li> <li><p>Select <strong>Create VM</strong> from the menu.</p> </li> <li><p>Enter the virtual machine information. The user name and password entered here will be used to log in to the virtual machine. When complete, select <strong>OK</strong>. You can create the new VM in an existing resource group, or choose <strong>Create new</strong> to create a new resource group to store the VM.</p> </li> <li><p>Select a size for the VM. To see more sizes, select <strong>View all</strong> or change the <strong>Supported disk type</strong> filter.</p> </li> <li><p>Under <strong>Settings</strong>, make changes as necessary and select <strong>OK</strong>.</p> </li> <li><p>On the summary page, you should see your image name listed as a <strong>Private image</strong>. Select <strong>Ok</strong> to start the virtual machine deployment.</p> </li> </ol> </div> </section> <section id="ms--how-to-procedure-section" class="anchor-headings"> <h2 id="powershell-create-a-vm-from-a-legacy-managed-image" class="title font-size-h2 margin-top-sm margin-bottom-xs">PowerShell: Create a VM from a legacy managed image </h2> <div class="content"><p>You can use PowerShell to create a VM from an image by using the simplified parameter set for the <a href="/en-us/powershell/module/az.compute/new-azvm" data-linktype="absolute-path">New-AzVm</a> cmdlet. The image needs to be in the same resource group where you'll create the VM.</p> <p>The simplified parameter set for <a href="/en-us/powershell/module/az.compute/new-azvm" data-linktype="absolute-path">New-AzVm</a> only requires that you provide a name, resource group, and image name to create a VM from an image. New-AzVm will use the value of the <strong>-Name</strong> parameter as the name of all of the resources that it creates automatically. In this example, we provide more detailed names for each of the resources but let the cmdlet create them automatically. You can also create resources beforehand, such as the virtual network, and pass the resource name into the cmdlet. New-AzVm will use the existing resources if it can find them by their name.</p> <p>The following example creates a VM named <em>myVMFromImage</em>, in the <em>myResourceGroup</em> resource group, from the image named <em>myImage</em>.</p> </div> <div class="code-section content"><pre><code class="lang-azurepowershell" data-interactive="azurepowershell">New-AzVm ` -ResourceGroupName "myResourceGroup" ` -Name "myVMfromImage" ` -ImageName "myImage" ` -Location "East US" ` -VirtualNetworkName "myImageVnet" ` -SubnetName "myImageSubnet" ` -SecurityGroupName "myImageNSG" ` -PublicIpAddressName "myImagePIP" </code></pre> </div> </section> <section id="ms--how-to-next-step-section" class="content"> <h2 id="next-step" class="title font-size-h2 margin-top-sm margin-bottom-xs">Next step</h2> <div class="buttons"> <a class="button button-primary button-filled" href="shared-image-galleries" data-bi-name="next-step-cta" data-linktype="relative-path"><span>Store and share images in an Azure Compute Gallery</span></a> </div> </section> </div> <script type="application/ld+json"> {"@context":"https://schema.org","@type":"HowTo","name":"Create a legacy managed image of a generalized VM in Azure\n","description":"\u003cdiv class=\"IMPORTANT\"\u003e\n\u003cp\u003eImportant\u003c/p\u003e\n\u003cp\u003eThis article covers the older managed image technology. For the most\ncurrent technology, customers are encouraged to use\n\u003ca href=\"azure-compute-gallery\"\u003eAzure Compute Gallery\u003c/a\u003e. All new features, like\nARM64, Trusted Launch, and Confidential VM are only supported through\nAzure Compute Gallery. If you have an existing managed image, you can use\nit as a source and create an Azure Compute Gallery image. For more\ninformation, see\n\u003ca href=\"image-version\"\u003eCreate an image definition and image version\u003c/a\u003e.\u003c/p\u003e\n\u003cp\u003eOnce you mark a VM as \u003ccode\u003egeneralized\u003c/code\u003e in Azure, you cannot restart the VM.\u003c/p\u003e\n\u003cp\u003eOne managed image supports up to 20 simultaneous deployments. Attempting\nto create more than 20 VMs concurrently, from the same managed image, may\nresult in provisioning timeouts due to the storage performance limitations\nof a single VHD. To create more than 20 VMs concurrently, use an\n\u003ca href=\"shared-image-galleries\"\u003eAzure Compute Gallery\u003c/a\u003e (formerly known as\nShared Image Gallery) image configured with 1 replica for every 20\nconcurrent VM deployments.\u003c/p\u003e\n\u003c/div\u003e\n\u003cp\u003eFor information on how managed images are billed, see\n\u003ca href=\"https://azure.microsoft.com/pricing/details/managed-disks/\"\u003eManaged Disks pricing\u003c/a\u003e.\u003c/p\u003e\n","step":[{"@type":"HowToSection","name":"CLI: Create a legacy managed image of a VM\n","itemListElement":[{"@type":"HowToStep","text":"\u003cpre\u003e\u003ccode class=\"lang-azurecli\"\u003eaz image create \\\n --resource-group myResourceGroup \\\n --name myImage --source myVM\n\u003c/code\u003e\u003c/pre\u003e\n\u003cdiv class=\"NOTE\"\u003e\n\u003cp\u003eNote\u003c/p\u003e\n\u003cp\u003eThe image is created in the same resource group as your source VM. You\ncan create VMs in any resource group within your subscription from this\nimage. From a management perspective, you may wish to create a specific\nresource group for your VM resources and images.\u003c/p\u003e\n\u003cp\u003eIf you are capturing an image of a generation 2 VM, also use the\n\u003ccode\u003e--hyper-v-generation V2\u003c/code\u003e parameter. for more information, see\n\u003ca href=\"generation-2\"\u003eGeneration 2 VMs\u003c/a\u003e.\u003c/p\u003e\n\u003cp\u003eIf you would like to store your image in zone-resilient storage, you\nneed to create it in a region that supports\n\u003ca href=\"/azure/reliability/availability-zones-overview\"\u003eavailability zones\u003c/a\u003e and include\nthe \u003ccode\u003e--zone-resilient true\u003c/code\u003e parameter.\u003c/p\u003e\n\u003c/div\u003e\n\u003cp\u003eThis command returns JSON that describes the VM image. Save this output for later reference.\u003c/p\u003e\n"}]},{"@type":"HowToSection","name":"PowerShell: Create a legacy managed image of a VM\n","itemListElement":[{"@type":"HowToStep","text":"\u003cp\u003eCreate some variables.\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"lang-azurepowershell\" data-interactive=\"azurepowershell\"\u003e$vmName = \u0026quot;myVM\u0026quot;\n$rgName = \u0026quot;myResourceGroup\u0026quot;\n$location = \u0026quot;EastUS\u0026quot;\n$imageName = \u0026quot;myImage\u0026quot;\n\u003c/code\u003e\u003c/pre\u003e\n"},{"@type":"HowToStep","text":"\u003cp\u003eMake sure the VM has been deallocated.\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"lang-azurepowershell\" data-interactive=\"azurepowershell\"\u003eStop-AzVM -ResourceGroupName $rgName -Name $vmName -Force\n\u003c/code\u003e\u003c/pre\u003e\n"},{"@type":"HowToStep","text":"\u003cp\u003eSet the status of the virtual machine to \u003cstrong\u003eGeneralized\u003c/strong\u003e.\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"lang-azurepowershell\" data-interactive=\"azurepowershell\"\u003eSet-AzVm -ResourceGroupName $rgName -Name $vmName -Generalized\n\u003c/code\u003e\u003c/pre\u003e\n"},{"@type":"HowToStep","text":"\u003cp\u003eGet the virtual machine.\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"lang-azurepowershell\" data-interactive=\"azurepowershell\"\u003e$vm = Get-AzVM -Name $vmName -ResourceGroupName $rgName\n\u003c/code\u003e\u003c/pre\u003e\n"},{"@type":"HowToStep","text":"\u003cp\u003eCreate the image configuration.\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"lang-azurepowershell\" data-interactive=\"azurepowershell\"\u003e$image = New-AzImageConfig -Location $location -SourceVirtualMachineId $vm.Id \n\u003c/code\u003e\u003c/pre\u003e\n"},{"@type":"HowToStep","text":"\u003cp\u003eCreate the image.\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"lang-azurepowershell\" data-interactive=\"azurepowershell\"\u003eNew-AzImage -ImageName $imageName -ResourceGroupName $rgName -Image $imageConfig\n\u003c/code\u003e\u003c/pre\u003e\n"}]},{"@type":"HowToSection","name":"PowerShell: Create a legacy managed image from a managed disk \n","itemListElement":[{"@type":"HowToStep","text":"\u003cp\u003eCreate some variables.\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"lang-azurepowershell\" data-interactive=\"azurepowershell\"\u003e$vmName = \u0026quot;myVM\u0026quot;\n$rgName = \u0026quot;myResourceGroup\u0026quot;\n$location = \u0026quot;EastUS\u0026quot;\n$imageName = \u0026quot;myImage\u0026quot;\n\u003c/code\u003e\u003c/pre\u003e\n"},{"@type":"HowToStep","text":"\u003cp\u003eGet the VM.\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"lang-azurepowershell\" data-interactive=\"azurepowershell\"\u003e$vm = Get-AzVm -Name $vmName -ResourceGroupName $rgName\n\u003c/code\u003e\u003c/pre\u003e\n"},{"@type":"HowToStep","text":"\u003cp\u003eGet the ID of the managed disk.\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"lang-azurepowershell\" data-interactive=\"azurepowershell\"\u003e$diskID = $vm.StorageProfile.OsDisk.ManagedDisk.Id\n\u003c/code\u003e\u003c/pre\u003e\n"},{"@type":"HowToStep","text":"\u003cp\u003eCreate the image configuration.\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"lang-azurepowershell\" data-interactive=\"azurepowershell\"\u003e$imageConfig = New-AzImageConfig -Location $location\n$imageConfig = Set-AzImageOsDisk -Image $imageConfig -OsState Generalized -OsType Windows -ManagedDiskId $diskID\n\u003c/code\u003e\u003c/pre\u003e\n"},{"@type":"HowToStep","text":"\u003cp\u003eCreate the image.\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"lang-azurepowershell\" data-interactive=\"azurepowershell\"\u003eNew-AzImage -ImageName $imageName -ResourceGroupName $rgName -Image $imageConfig\n\u003c/code\u003e\u003c/pre\u003e\n"}]},{"@type":"HowToSection","name":"PowerShell: Create a legacy managed image from a snapshot\n","itemListElement":[{"@type":"HowToStep","text":"\u003cp\u003eCreate some variables.\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"lang-azurepowershell\" data-interactive=\"azurepowershell\"\u003e$rgName = \u0026quot;myResourceGroup\u0026quot;\n$location = \u0026quot;EastUS\u0026quot;\n$snapshotName = \u0026quot;mySnapshot\u0026quot;\n$imageName = \u0026quot;myImage\u0026quot;\n\u003c/code\u003e\u003c/pre\u003e\n"},{"@type":"HowToStep","text":"\u003cp\u003eGet the snapshot.\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"lang-azurepowershell\" data-interactive=\"azurepowershell\"\u003e$snapshot = Get-AzSnapshot -ResourceGroupName $rgName -SnapshotName $snapshotName\n\u003c/code\u003e\u003c/pre\u003e\n"},{"@type":"HowToStep","text":"\u003cp\u003eCreate the image configuration.\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"lang-azurepowershell\" data-interactive=\"azurepowershell\"\u003e$imageConfig = New-AzImageConfig -Location $location\n$imageConfig = Set-AzImageOsDisk -Image $imageConfig -OsState Generalized -OsType Windows -SnapshotId $snapshot.Id\n\u003c/code\u003e\u003c/pre\u003e\n"},{"@type":"HowToStep","text":"\u003cp\u003eCreate the image.\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"lang-azurepowershell\" data-interactive=\"azurepowershell\"\u003eNew-AzImage -ImageName $imageName -ResourceGroupName $rgName -Image $imageConfig\n\u003c/code\u003e\u003c/pre\u003e\n"}]},{"@type":"HowToSection","name":"PowerShell: Create a legacy managed image from a VM that uses a storage account\n","itemListElement":[{"@type":"HowToStep","text":"\u003cp\u003eCreate some variables.\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"lang-azurepowershell\" data-interactive=\"azurepowershell\"\u003e$vmName = \u0026quot;myVM\u0026quot;\n$rgName = \u0026quot;myResourceGroup\u0026quot;\n$location = \u0026quot;EastUS\u0026quot;\n$imageName = \u0026quot;myImage\u0026quot;\n$osVhdUri = \u0026quot;https://mystorageaccount.blob.core.windows.net/vhdcontainer/vhdfilename.vhd\u0026quot;\n\u003c/code\u003e\u003c/pre\u003e\n"},{"@type":"HowToStep","text":"\u003cp\u003eStop/deallocate the VM.\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"lang-azurepowershell\" data-interactive=\"azurepowershell\"\u003eStop-AzVM -ResourceGroupName $rgName -Name $vmName -Force\n\u003c/code\u003e\u003c/pre\u003e\n"},{"@type":"HowToStep","text":"\u003cp\u003eMark the VM as generalized.\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"lang-azurepowershell\" data-interactive=\"azurepowershell\"\u003eSet-AzVm -ResourceGroupName $rgName -Name $vmName -Generalized \n\u003c/code\u003e\u003c/pre\u003e\n"},{"@type":"HowToStep","text":"\u003cp\u003eCreate the image by using your generalized OS VHD.\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"lang-azurepowershell\" data-interactive=\"azurepowershell\"\u003e$imageConfig = New-AzImageConfig -Location $location\n$imageConfig = Set-AzImageOsDisk -Image $imageConfig -OsType Windows -OsState Generalized -BlobUri $osVhdUri\n$image = New-AzImage -ImageName $imageName -ResourceGroupName $rgName -Image $imageConfig\n\u003c/code\u003e\u003c/pre\u003e\n"}]},{"@type":"HowToSection","name":"CLI: Create a VM from a legacy managed image\n","itemListElement":[{"@type":"HowToStep","text":"\u003cpre\u003e\u003ccode class=\"lang-azurecli\"\u003eaz vm create \\\n --resource-group myResourceGroup \\\n --name myVMDeployed \\\n --image myImage\\\n --admin-username azureuser \\\n --ssh-key-value ~/.ssh/id_rsa.pub\n\u003c/code\u003e\u003c/pre\u003e\n"}]},{"@type":"HowToSection","name":"CLI: Create a VM in another resource group from a legacy managed image\n","itemListElement":[{"@type":"HowToStep","text":"\u003cpre\u003e\u003ccode class=\"lang-azurecli\"\u003eaz vm create \\\n --resource-group myOtherResourceGroup \\\n --name myOtherVMDeployed \\\n --image \u0026quot;/subscriptions/guid/resourceGroups/MYRESOURCEGROUP/providers/Microsoft.Compute/images/myImage\u0026quot; \\\n --admin-username azureuser \\\n --ssh-key-value ~/.ssh/id_rsa.pub\n\u003c/code\u003e\u003c/pre\u003e\n"}]},{"@type":"HowToSection","name":"Portal: Create a VM from a legacy managed image\n","itemListElement":[{"@type":"HowToStep","text":"\u003cp\u003eGo to the \u003ca href=\"https://portal.azure.com\"\u003eAzure portal\u003c/a\u003e to find a managed\nimage. Search for and select \u003cstrong\u003eImages\u003c/strong\u003e.\u003c/p\u003e\n"},{"@type":"HowToStep","text":"\u003cp\u003eSelect the image you want to use from the list. The image \u003cstrong\u003eOverview\u003c/strong\u003e\npage opens.\u003c/p\u003e\n"},{"@type":"HowToStep","text":"\u003cp\u003eSelect \u003cstrong\u003eCreate VM\u003c/strong\u003e from the menu.\u003c/p\u003e\n"},{"@type":"HowToStep","text":"\u003cp\u003eEnter the virtual machine information. The user name and password\nentered here will be used to log in to the virtual machine. When\ncomplete, select \u003cstrong\u003eOK\u003c/strong\u003e. You can create the new VM in an existing\nresource group, or choose \u003cstrong\u003eCreate new\u003c/strong\u003e to create a new resource group\nto store the VM.\u003c/p\u003e\n"},{"@type":"HowToStep","text":"\u003cp\u003eSelect a size for the VM. To see more sizes, select \u003cstrong\u003eView all\u003c/strong\u003e or\nchange the \u003cstrong\u003eSupported disk type\u003c/strong\u003e filter.\u003c/p\u003e\n"},{"@type":"HowToStep","text":"\u003cp\u003eUnder \u003cstrong\u003eSettings\u003c/strong\u003e, make changes as necessary and select \u003cstrong\u003eOK\u003c/strong\u003e.\u003c/p\u003e\n"},{"@type":"HowToStep","text":"\u003cp\u003eOn the summary page, you should see your image name listed as a\n\u003cstrong\u003ePrivate image\u003c/strong\u003e. Select \u003cstrong\u003eOk\u003c/strong\u003e to start the virtual machine\ndeployment.\u003c/p\u003e\n"}]},{"@type":"HowToSection","name":"PowerShell: Create a VM from a legacy managed image\n","itemListElement":[{"@type":"HowToStep","text":"\u003cpre\u003e\u003ccode class=\"lang-azurepowershell\" data-interactive=\"azurepowershell\"\u003eNew-AzVm `\n -ResourceGroupName \u0026quot;myResourceGroup\u0026quot; `\n -Name \u0026quot;myVMfromImage\u0026quot; `\n -ImageName \u0026quot;myImage\u0026quot; `\n -Location \u0026quot;East US\u0026quot; `\n -VirtualNetworkName \u0026quot;myImageVnet\u0026quot; `\n -SubnetName \u0026quot;myImageSubnet\u0026quot; `\n -SecurityGroupName \u0026quot;myImageNSG\u0026quot; `\n -PublicIpAddressName \u0026quot;myImagePIP\u0026quot; \n\u003c/code\u003e\u003c/pre\u003e\n"}]}],"supply":["\u003cp\u003eYou need a \u003ca href=\"generalize\"\u003egeneralized\u003c/a\u003e VM in order to create an image.\u003c/p\u003e\n"]} </script> </div><div id="assertive-live-region" role="alert" aria-live="assertive" class="visually-hidden" aria-relevant="additions" aria-atomic="true"></div> <div id="polite-live-region" role="status" aria-live="polite" class="visually-hidden" aria-relevant="additions" aria-atomic="true"></div> <!-- </content> --> </main><!-- recommendations section --><!-- end recommendations section --> <!-- feedback section --><section id="site-user-feedback-footer" class="font-size-sm margin-top-md" data-test-id="site-user-feedback-footer" data-bi-name="site-feedback-section"> <hr class="hr" /> <h2 id="feedback" class="title is-3">Feedback</h2> <div class="display-flex flex-wrap-wrap align-items-center"> <p class="font-weight-semibold margin-xxs margin-left-none">Was this page helpful?</p> <div class="buttons"> <button class="thumb-rating-button like button button-primary button-sm" data-test-id="footer-rating-yes" data-binary-rating-response="rating-yes" type="button" title="This article is helpful" data-bi-name="button-rating-yes" aria-pressed="false" > <span class="icon" aria-hidden="true"> <span class="docon docon-like"></span> </span> <span>Yes</span> </button> <button class="thumb-rating-button dislike button button-primary button-sm" data-test-id="footer-rating-no" data-binary-rating-response="rating-no" type="button" title="This article is not helpful" data-bi-name="button-rating-no" aria-pressed="false" > <span class="icon" aria-hidden="true"> <span class="docon docon-dislike"></span> </span> <span>No</span> </button> </div> </div><div class="display-flex flex-wrap-wrap margin-top-xxs"><div> <a data-bi-name="provide-feedback-cta" class="has-external-link-indicator" href="https://feedback.azure.com/d365community/forum/79b1327d-d925-ec11-b6e6-000d3a4f06a4" data-bi-name="product-feedback" > <span>Provide product feedback</span> </a><span class="margin-inline-xxs" aria-hidden="true">|</span></div><a href="https://learn.microsoft.com/answers/tags/94/azure-virtual-machines/" class="has-external-link-indicator" data-bi-name="get-help-at-qna"> <span>Get help at Microsoft Q&A</span> </a></div> </section><!-- end feedback section --> <!-- feedback report section --><!-- end feedback report section --><div class="border-top is-visible-interactive has-default-focus margin-top-sm "><footer id="footer-interactive" data-bi-name="footer" class="footer-layout"><div class="display-flex gap-xs flex-wrap-wrap is-full-height padding-right-lg-desktop"><a data-mscc-ic="false" class="locale-selector-link button button-sm button-clear flex-shrink-0" href="#" data-bi-name="select-locale"> <span class="icon" aria-hidden="true"> <span class="docon docon-world"></span> </span> <span class="local-selector-link-text"></span></a><div class="ccpa-privacy-link" data-ccpa-privacy-link hidden> <a href="https://aka.ms/yourcaliforniaprivacychoices" class="button button-sm button-clear flex-shrink-0" data-mscc-ic="false" data-bi-name="your-privacy-choices" > <svg role="img" aria-label="California Consumer Privacy Act (CCPA) Opt-Out Icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 14" xml:space="preserve" height="16" width="43" focusable="false" > <title>California Consumer Privacy Act (CCPA) Opt-Out Icon</title> <path d="M7.4 12.8h6.8l3.1-11.6H7.4C4.2 1.2 1.6 3.8 1.6 7s2.6 5.8 5.8 5.8z" style="fill-rule:evenodd;clip-rule:evenodd;fill:#fff"></path> <path d="M22.6 0H7.4c-3.9 0-7 3.1-7 7s3.1 7 7 7h15.2c3.9 0 7-3.1 7-7s-3.2-7-7-7zm-21 7c0-3.2 2.6-5.8 5.8-5.8h9.9l-3.1 11.6H7.4c-3.2 0-5.8-2.6-5.8-5.8z" style="fill-rule:evenodd;clip-rule:evenodd;fill:#06f"></path> <path d="M24.6 4c.2.2.2.6 0 .8L22.5 7l2.2 2.2c.2.2.2.6 0 .8-.2.2-.6.2-.8 0l-2.2-2.2-2.2 2.2c-.2.2-.6.2-.8 0-.2-.2-.2-.6 0-.8L20.8 7l-2.2-2.2c-.2-.2-.2-.6 0-.8.2-.2.6-.2.8 0l2.2 2.2L23.8 4c.2-.2.6-.2.8 0z" style="fill:#fff"></path> <path d="M12.7 4.1c.2.2.3.6.1.8L8.6 9.8c-.1.1-.2.2-.3.2-.2.1-.5.1-.7-.1L5.4 7.7c-.2-.2-.2-.6 0-.8.2-.2.6-.2.8 0L8 8.6l3.8-4.5c.2-.2.6-.2.9 0z" style="fill:#06f"></path> </svg> <span>Your Privacy Choices</span> </a> </div> <div class="flex-shrink-0"> <div class="dropdown has-caret-up"> <button class="dropdown-trigger button button-clear button-sm has-inner-focus theme-dropdown-trigger" aria-controls="theme-menu-interactive" aria-expanded="false" title="Theme" data-bi-name="theme"> <span class="icon"> <span class="docon docon-sun" aria-hidden="true"></span> </span> <span>Theme</span> <span class="icon expanded-indicator" aria-hidden="true"> <span class="docon docon-chevron-down-light"></span> </span> </button> <div class="dropdown-menu" id="theme-menu-interactive" role="menu"> <ul class="theme-selector padding-xxs" role="none"> <li class="theme display-block" role="menuitem"> <button class="button button-clear button-sm theme-control button-block justify-content-flex-start" data-theme-to="light"> <span class="theme-light margin-right-xxs"> <span class="theme-selector-icon border display-inline-block has-body-background" aria-hidden="true"> <svg class="svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 14"> <rect width="22" height="14" class="has-fill-body-background" /> <rect x="5" y="5" width="12" height="4" class="has-fill-secondary" /> <rect x="5" y="2" width="2" height="1" class="has-fill-secondary" /> <rect x="8" y="2" width="2" height="1" class="has-fill-secondary" /> <rect x="11" y="2" width="3" height="1" class="has-fill-secondary" /> <rect x="1" y="1" width="2" height="2" class="has-fill-secondary" /> <rect x="5" y="10" width="7" height="2" rx="0.3" class="has-fill-primary" /> <rect x="19" y="1" width="2" height="2" rx="1" class="has-fill-secondary" /> </svg> </span> </span> <span>Light</span> </button> </li> <li class="theme display-block" role="menuitem"> <button class="button button-clear button-sm theme-control button-block justify-content-flex-start" data-theme-to="dark"> <span class="theme-dark margin-right-xxs"> <span class="border theme-selector-icon display-inline-block has-body-background" aria-hidden="true"> <svg class="svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 14"> <rect width="22" height="14" class="has-fill-body-background" /> <rect x="5" y="5" width="12" height="4" class="has-fill-secondary" /> <rect x="5" y="2" width="2" height="1" class="has-fill-secondary" /> <rect x="8" y="2" width="2" height="1" class="has-fill-secondary" /> <rect x="11" y="2" width="3" height="1" class="has-fill-secondary" /> <rect x="1" y="1" width="2" height="2" class="has-fill-secondary" /> <rect x="5" y="10" width="7" height="2" rx="0.3" class="has-fill-primary" /> <rect x="19" y="1" width="2" height="2" rx="1" class="has-fill-secondary" /> </svg> </span> </span> <span>Dark</span> </button> </li> <li class="theme display-block" role="menuitem"> <button class="button button-clear button-sm theme-control button-block justify-content-flex-start" data-theme-to="high-contrast"> <span class="theme-high-contrast margin-right-xxs"> <span class="border theme-selector-icon display-inline-block has-body-background" aria-hidden="true"> <svg class="svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 14"> <rect width="22" height="14" class="has-fill-body-background" /> <rect x="5" y="5" width="12" height="4" class="has-fill-secondary" /> <rect x="5" y="2" width="2" height="1" class="has-fill-secondary" /> <rect x="8" y="2" width="2" height="1" class="has-fill-secondary" /> <rect x="11" y="2" width="3" height="1" class="has-fill-secondary" /> <rect x="1" y="1" width="2" height="2" class="has-fill-secondary" /> <rect x="5" y="10" width="7" height="2" rx="0.3" class="has-fill-primary" /> <rect x="19" y="1" width="2" height="2" rx="1" class="has-fill-secondary" /> </svg> </span> </span> <span>High contrast</span> </button> </li> </ul> </div> </div> </div> </div> <ul class="links" data-bi-name="footerlinks"> <li class="manage-cookies-holder" hidden></li><li><a class="external-link-indicator" data-mscc-ic="false" href="/en-us/previous-versions/" data-bi-name="archivelink">Previous Versions</a></li> <li><a class="external-link-indicator" data-mscc-ic="false" href="https://techcommunity.microsoft.com/t5/microsoft-learn-blog/bg-p/MicrosoftLearnBlog" data-bi-name="bloglink">Blog</a></li> <li><a class="external-link-indicator" data-mscc-ic="false" href="/en-us/contribute/" data-bi-name="contributorGuide">Contribute</a></li><li><a class="external-link-indicator" data-mscc-ic="false" href="https://go.microsoft.com/fwlink/?LinkId=521839" data-bi-name="privacy">Privacy</a></li><li><a class="external-link-indicator" data-mscc-ic="false" href="/en-us/legal/termsofuse" data-bi-name="termsofuse">Terms of Use</a></li><li><a class="external-link-indicator" data-mscc-ic="false" href="https://www.microsoft.com/legal/intellectualproperty/Trademarks/" data-bi-name="trademarks">Trademarks</a></li><li>© Microsoft 2024</li> </ul> </footer></div></div><div id="ms--additional-resources" class="right-container column is-4-desktop display-none display-block-desktop" data-bi-name="pageactions" role="complementary" aria-label="Additional resources" > <div id="affixed-right-container" class="margin-top-sm-tablet" data-bi-name="right-column"> <h2 id="ms--additional-resources-heading" class="title is-6 margin-top-md" hidden>Additional resources</h2> <section id="right-rail-events" data-bi-name="events-card" hidden></section> <section id="right-rail-training" data-bi-name="learning-resources-card" hidden></section> <section id="right-rail-recommendations" data-bi-name="recommendations" hidden></section> <nav id="side-doc-outline" class="doc-outline" data-bi-name="intopic toc" aria-label="In this article"> <h3>In this article</h3> </nav> <section id="right-rail-qna" class="margin-top-xxs" data-bi-name="qna-link-card" hidden></section> </div> </div></div> <!--end of div.columns --> </section> <!--end of .primary-holder --> <!-- interactive container --> <aside id="interactive-container" class="interactive-container is-visible-interactive column has-body-background-dark "> </aside> <!-- end of interactive container --> </div> </div> <!--end of .mainContainer --> <section class="border-top has-default-focus is-hidden-interactive margin-top-sm "><footer id="footer" data-bi-name="footer" class="footer-layout uhf-container has-padding" role="contentinfo"><div class="display-flex gap-xs flex-wrap-wrap is-full-height padding-right-lg-desktop"><a data-mscc-ic="false" class="locale-selector-link button button-sm button-clear flex-shrink-0" href="#" data-bi-name="select-locale"> <span class="icon" aria-hidden="true"> <span class="docon docon-world"></span> </span> <span class="local-selector-link-text"></span></a><div class="ccpa-privacy-link" data-ccpa-privacy-link hidden> <a href="https://aka.ms/yourcaliforniaprivacychoices" class="button button-sm button-clear flex-shrink-0" data-mscc-ic="false" data-bi-name="your-privacy-choices" > <svg role="img" aria-label="California Consumer Privacy Act (CCPA) Opt-Out Icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 14" xml:space="preserve" height="16" width="43" focusable="false" > <title>California Consumer Privacy Act (CCPA) Opt-Out Icon</title> <path d="M7.4 12.8h6.8l3.1-11.6H7.4C4.2 1.2 1.6 3.8 1.6 7s2.6 5.8 5.8 5.8z" style="fill-rule:evenodd;clip-rule:evenodd;fill:#fff"></path> <path d="M22.6 0H7.4c-3.9 0-7 3.1-7 7s3.1 7 7 7h15.2c3.9 0 7-3.1 7-7s-3.2-7-7-7zm-21 7c0-3.2 2.6-5.8 5.8-5.8h9.9l-3.1 11.6H7.4c-3.2 0-5.8-2.6-5.8-5.8z" style="fill-rule:evenodd;clip-rule:evenodd;fill:#06f"></path> <path d="M24.6 4c.2.2.2.6 0 .8L22.5 7l2.2 2.2c.2.2.2.6 0 .8-.2.2-.6.2-.8 0l-2.2-2.2-2.2 2.2c-.2.2-.6.2-.8 0-.2-.2-.2-.6 0-.8L20.8 7l-2.2-2.2c-.2-.2-.2-.6 0-.8.2-.2.6-.2.8 0l2.2 2.2L23.8 4c.2-.2.6-.2.8 0z" style="fill:#fff"></path> <path d="M12.7 4.1c.2.2.3.6.1.8L8.6 9.8c-.1.1-.2.2-.3.2-.2.1-.5.1-.7-.1L5.4 7.7c-.2-.2-.2-.6 0-.8.2-.2.6-.2.8 0L8 8.6l3.8-4.5c.2-.2.6-.2.9 0z" style="fill:#06f"></path> </svg> <span>Your Privacy Choices</span> </a> </div> <div class="flex-shrink-0"> <div class="dropdown has-caret-up"> <button class="dropdown-trigger button button-clear button-sm has-inner-focus theme-dropdown-trigger" aria-controls="theme-menu" aria-expanded="false" title="Theme" data-bi-name="theme"> <span class="icon"> <span class="docon docon-sun" aria-hidden="true"></span> </span> <span>Theme</span> <span class="icon expanded-indicator" aria-hidden="true"> <span class="docon docon-chevron-down-light"></span> </span> </button> <div class="dropdown-menu" id="theme-menu" role="menu"> <ul class="theme-selector padding-xxs" role="none"> <li class="theme display-block" role="menuitem"> <button class="button button-clear button-sm theme-control button-block justify-content-flex-start" data-theme-to="light"> <span class="theme-light margin-right-xxs"> <span class="theme-selector-icon border display-inline-block has-body-background" aria-hidden="true"> <svg class="svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 14"> <rect width="22" height="14" class="has-fill-body-background" /> <rect x="5" y="5" width="12" height="4" class="has-fill-secondary" /> <rect x="5" y="2" width="2" height="1" class="has-fill-secondary" /> <rect x="8" y="2" width="2" height="1" class="has-fill-secondary" /> <rect x="11" y="2" width="3" height="1" class="has-fill-secondary" /> <rect x="1" y="1" width="2" height="2" class="has-fill-secondary" /> <rect x="5" y="10" width="7" height="2" rx="0.3" class="has-fill-primary" /> <rect x="19" y="1" width="2" height="2" rx="1" class="has-fill-secondary" /> </svg> </span> </span> <span>Light</span> </button> </li> <li class="theme display-block" role="menuitem"> <button class="button button-clear button-sm theme-control button-block justify-content-flex-start" data-theme-to="dark"> <span class="theme-dark margin-right-xxs"> <span class="border theme-selector-icon display-inline-block has-body-background" aria-hidden="true"> <svg class="svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 14"> <rect width="22" height="14" class="has-fill-body-background" /> <rect x="5" y="5" width="12" height="4" class="has-fill-secondary" /> <rect x="5" y="2" width="2" height="1" class="has-fill-secondary" /> <rect x="8" y="2" width="2" height="1" class="has-fill-secondary" /> <rect x="11" y="2" width="3" height="1" class="has-fill-secondary" /> <rect x="1" y="1" width="2" height="2" class="has-fill-secondary" /> <rect x="5" y="10" width="7" height="2" rx="0.3" class="has-fill-primary" /> <rect x="19" y="1" width="2" height="2" rx="1" class="has-fill-secondary" /> </svg> </span> </span> <span>Dark</span> </button> </li> <li class="theme display-block" role="menuitem"> <button class="button button-clear button-sm theme-control button-block justify-content-flex-start" data-theme-to="high-contrast"> <span class="theme-high-contrast margin-right-xxs"> <span class="border theme-selector-icon display-inline-block has-body-background" aria-hidden="true"> <svg class="svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 14"> <rect width="22" height="14" class="has-fill-body-background" /> <rect x="5" y="5" width="12" height="4" class="has-fill-secondary" /> <rect x="5" y="2" width="2" height="1" class="has-fill-secondary" /> <rect x="8" y="2" width="2" height="1" class="has-fill-secondary" /> <rect x="11" y="2" width="3" height="1" class="has-fill-secondary" /> <rect x="1" y="1" width="2" height="2" class="has-fill-secondary" /> <rect x="5" y="10" width="7" height="2" rx="0.3" class="has-fill-primary" /> <rect x="19" y="1" width="2" height="2" rx="1" class="has-fill-secondary" /> </svg> </span> </span> <span>High contrast</span> </button> </li> </ul> </div> </div> </div> </div> <ul class="links" data-bi-name="footerlinks"> <li class="manage-cookies-holder" hidden></li><li><a class="external-link-indicator" data-mscc-ic="false" href="/en-us/previous-versions/" data-bi-name="archivelink">Previous Versions</a></li> <li><a class="external-link-indicator" data-mscc-ic="false" href="https://techcommunity.microsoft.com/t5/microsoft-learn-blog/bg-p/MicrosoftLearnBlog" data-bi-name="bloglink">Blog</a></li> <li><a class="external-link-indicator" data-mscc-ic="false" href="/en-us/contribute/" data-bi-name="contributorGuide">Contribute</a></li><li><a class="external-link-indicator" data-mscc-ic="false" href="https://go.microsoft.com/fwlink/?LinkId=521839" data-bi-name="privacy">Privacy</a></li><li><a class="external-link-indicator" data-mscc-ic="false" href="/en-us/legal/termsofuse" data-bi-name="termsofuse">Terms of Use</a></li><li><a class="external-link-indicator" data-mscc-ic="false" href="https://www.microsoft.com/legal/intellectualproperty/Trademarks/" data-bi-name="trademarks">Trademarks</a></li><li>© Microsoft 2024</li> </ul> </footer> </section> <div id="action-panel" role="region" aria-label="Action Panel" class="action-panel has-default-focus" tabindex="-1"></div> </body> </html>