Create a VM from a managed image
You can create multiple virtual machines (VMs) from an Azure managed VM image using the Azure portal or PowerShell. A managed VM image contains the information necessary to create a VM, including the OS and data disks. The virtual hard disks (VHDs) that make up the image, including both the OS disks and any data disks, are stored as managed disks.
Before creating a new VM, you'll need to create a managed VM image to use as the source image and grant read access on the image to any user who should have access to the image.
Use the portal
- Open the Azure portal.
- On the left menu, select All resources. You can sort the resources by Type to easily find your images.
- Select the image you want to use from the list. The image Overview page opens.
- Select Create VM from the menu.
- 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 OK. You can create the new VM in an existing resource group, or choose Create new to create a new resource group to store the VM.
- Select a size for the VM. To see more sizes, select View all or change the Supported disk type filter.
- Under Settings, make changes as necessary and select OK.
- On the summary page, you should see your image name listed as a Private image. Select Ok to start the virtual machine deployment.
You can use PowerShell to create a VM from an image by using the simplified parameter set for the New-AzVm cmdlet. The image needs to be in the same resource group where you'll create the VM.
This article has been updated to use the new Azure PowerShell Az module. You can still use the AzureRM module, which will continue to receive bug fixes until at least December 2020. To learn more about the new Az module and AzureRM compatibility, see Introducing the new Azure PowerShell Az module. For Az module installation instructions, see Install Azure PowerShell.
The simplified parameter set for New-AzVm 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 -Name 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.
The following example creates a VM named myVMFromImage, in the myResourceGroup resource group, from the image named myImage.
New-AzVm ` -ResourceGroupName "myResourceGroup" ` -Name "myVMfromImage" ` -ImageName "myImage" ` -Location "East US" ` -VirtualNetworkName "myImageVnet" ` -SubnetName "myImageSubnet" ` -SecurityGroupName "myImageNSG" ` -PublicIpAddressName "myImagePIP" ` -OpenPorts 3389