< Back
Save-AzureRmVMImage
Post
NAME Save-AzureRmVMImage
SYNOPSIS
Saves a virtual machine as a VMImage.
SYNTAX
Save-AzureRmVMImage [-Id] <String> [-Name] <String> [-DestinationContainerName] <String> [-VHDNamePrefix] <String> [[-Overwrite]] [[-Path]
<String>] [-AsJob] [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
Save-AzureRmVMImage [-ResourceGroupName] <String> [-Name] <String> [-DestinationContainerName] <String> [-VHDNamePrefix] <String> [[-Overwrite]]
[[-Path] <String>] [-AsJob] [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
DESCRIPTION
The Save-AzureRmVMImage 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-AzureRmVM cmdlet.
The output of this cmdlet is a JavaScript Object Notation (JSON) template. You can deploy virtual machines from your captured image.
PARAMETERS
-AsJob [<SwitchParameter>]
Run cmdlet in the background and return a Job to track progress.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-DefaultProfile <IAzureContextContainer>
The credentials, account, tenant, and subscription used for communication with azure.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-DestinationContainerName <String>
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.
Required? true
Position? 2
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-Id <String>
Specifies the Resource ID of the virtual machine.
Required? true
Position? 0
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-Name <String>
Specifies a name.
Required? true
Position? 1
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-Overwrite [<SwitchParameter>]
Indicates that this cmdlet overwrites any VHDs that have the same prefix in the destination container.
Required? false
Position? 4
Default value False
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-Path <String>
Specifies the path of the VHD.
Required? false
Position? 5
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-ResourceGroupName <String>
Specifies the name of the resource group of the virtual machine.
Required? true
Position? 0
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-VHDNamePrefix <String>
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.
Required? true
Position? 3
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
None
This cmdlet does not accept any input.
OUTPUTS
Microsoft.Azure.Commands.Compute.Models.PSComputeLongRunningOperation
NOTES
Example 1: Capture a virtual machine
PS C:\\> Set-AzureRmVM -ResourceGroupName "ResourceGroup11" -Name "VirtualMachine07" -Generalized
PS C:\\> Save-AzureRmVMImage -ResourceGroupName "ResourceGroup11" -VMName "VirtualMachine07" -DestinationContainerName "VMContainer01"
-VHDNamePrefix "VM07"
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.
RELATED LINKS
Online Version: https://docs.microsoft.com/en-us/powers ... ermvmimage
Get-AzureRmVMImage
Get-AzureRmVMImageOffer
Get-AzureRmVMImagePublisher
Get-AzureRmVMImageSku
Set-AzureRmVM
SYNOPSIS
Saves a virtual machine as a VMImage.
SYNTAX
Save-AzureRmVMImage [-Id] <String> [-Name] <String> [-DestinationContainerName] <String> [-VHDNamePrefix] <String> [[-Overwrite]] [[-Path]
<String>] [-AsJob] [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
Save-AzureRmVMImage [-ResourceGroupName] <String> [-Name] <String> [-DestinationContainerName] <String> [-VHDNamePrefix] <String> [[-Overwrite]]
[[-Path] <String>] [-AsJob] [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
DESCRIPTION
The Save-AzureRmVMImage 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-AzureRmVM cmdlet.
The output of this cmdlet is a JavaScript Object Notation (JSON) template. You can deploy virtual machines from your captured image.
PARAMETERS
-AsJob [<SwitchParameter>]
Run cmdlet in the background and return a Job to track progress.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-DefaultProfile <IAzureContextContainer>
The credentials, account, tenant, and subscription used for communication with azure.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-DestinationContainerName <String>
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.
Required? true
Position? 2
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-Id <String>
Specifies the Resource ID of the virtual machine.
Required? true
Position? 0
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-Name <String>
Specifies a name.
Required? true
Position? 1
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-Overwrite [<SwitchParameter>]
Indicates that this cmdlet overwrites any VHDs that have the same prefix in the destination container.
Required? false
Position? 4
Default value False
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-Path <String>
Specifies the path of the VHD.
Required? false
Position? 5
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-ResourceGroupName <String>
Specifies the name of the resource group of the virtual machine.
Required? true
Position? 0
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-VHDNamePrefix <String>
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.
Required? true
Position? 3
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
None
This cmdlet does not accept any input.
OUTPUTS
Microsoft.Azure.Commands.Compute.Models.PSComputeLongRunningOperation
NOTES
Example 1: Capture a virtual machine
PS C:\\> Set-AzureRmVM -ResourceGroupName "ResourceGroup11" -Name "VirtualMachine07" -Generalized
PS C:\\> Save-AzureRmVMImage -ResourceGroupName "ResourceGroup11" -VMName "VirtualMachine07" -DestinationContainerName "VMContainer01"
-VHDNamePrefix "VM07"
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.
RELATED LINKS
Online Version: https://docs.microsoft.com/en-us/powers ... ermvmimage
Get-AzureRmVMImage
Get-AzureRmVMImageOffer
Get-AzureRmVMImagePublisher
Get-AzureRmVMImageSku
Set-AzureRmVM