The Save-AzVMImage cmdlet saves a virtual machine as a VMImage.
Before you create a virtual machine image, sysprep the virtual machine, and then mark it as generalized by using the Set-AzVM cmdlet.
The output of this cmdlet is a JavaScript Object Notation (JSON) template.
You can deploy virtual machines from your captured image.
The first command marks the virtual machine named VirtualMachine07 as generalized.
The second command captures a virtual machine named VirtualMachine07 as a VMImage.
The Output property returns a JSON template.
Example 2
Saves a virtual machine as a VMImage. (autogenerated)
Specifies the name of a container inside the "system" container that you want to hold your images.
If the container doesn't exist, it is created for you.
The virtual hard disks (VHDs) that constitute the VMImage reside in the container that this parameter specifies.
If the VHDs are spread across multiple storage accounts, this cmdlet creates one container that has this name in each storage account.
The URL of the saved image is similar to:
https://<storageAccountName>.blob.core.windows.net/system/Microsoft.Compute/Images/<imagesContainer>/<vhdPrefix-osDisk>.xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.vhd.
Specifies the prefix in the name of the blobs that constitute the storage profile of the VMImage.
For example, a prefix vhdPrefix for an operating system disk results in the name vhdPrefix-osdisk.<guid>.vhd.
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable,
-ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see
about_CommonParameters.
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.