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.
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-AzureRmVm cmdlet. The image needs to be in the same resource group where you'll create the VM.
This example requires the AzureRM module version 5.6.0 or later. Run
Get-Module -ListAvailable AzureRM to find the version. If you need to upgrade, see Install Azure PowerShell module.
The simplified parameter set for New-AzureRmVm only requires that you provide a name, resource group, and image name to create a VM from an image. New-AzureRmVm 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-AzureRmVm 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-AzureRmVm ` -ResourceGroupName "myResourceGroup" ` -Name "myVMfromImage" ` -ImageName "myImage" ` -Location "East US" ` -VirtualNetworkName "myImageVnet" ` -SubnetName "myImageSubnet" ` -SecurityGroupName "myImageNSG" ` -PublicIpAddressName "myImagePIP" ` -OpenPorts 3389