Skip to content

Commit dee9b58

Browse files
authored
Merge pull request #89226 from diecknet/patch-1
Add support for Generation 2 VMs
2 parents f8876e3 + 59dcc29 commit dee9b58

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

articles/virtual-machines/windows/disks-upload-vhd-to-managed-disk-powershell.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,13 +188,14 @@ $sourceDiskName = <sourceDiskNameHere>
188188
$targetDiskName = <targetDiskNameHere>
189189
$targetRG = <targetResourceGroupHere>
190190
$targetLocate = <yourTargetLocationHere>
191+
$targetVmGeneration = "V1" # either V1 or V2
191192
#Expected value for OS is either "Windows" or "Linux"
192193
$targetOS = <yourOSTypeHere>
193194
194195
$sourceDisk = Get-AzDisk -ResourceGroupName $sourceRG -DiskName $sourceDiskName
195196
196197
# Adding the sizeInBytes with the 512 offset, and the -Upload flag
197-
$targetDiskconfig = New-AzDiskConfig -SkuName 'Standard_LRS' -osType $targetOS -UploadSizeInBytes $($sourceDisk.DiskSizeBytes+512) -Location $targetLocate -CreateOption 'Upload'
198+
$targetDiskconfig = New-AzDiskConfig -SkuName 'Standard_LRS' -osType $targetOS -UploadSizeInBytes $($sourceDisk.DiskSizeBytes+512) -Location $targetLocate -CreateOption 'Upload' -HyperVGeneration $targetVmGeneration
198199
199200
$targetDisk = New-AzDisk -ResourceGroupName $targetRG -DiskName $targetDiskName -Disk $targetDiskconfig
200201
@@ -213,4 +214,4 @@ Revoke-AzDiskAccess -ResourceGroupName $targetRG -DiskName $targetDiskName
213214

214215
Now that you've successfully uploaded a VHD to a managed disk, you can attach your disk to a VM and begin using it.
215216

216-
To learn how to attach a data disk to a VM, see our article on the subject: [Attach a data disk to a Windows VM with PowerShell](attach-disk-ps.md). To use the disk as the OS disk, see [Create a Windows VM from a specialized disk](create-vm-specialized.md#create-the-new-vm).
217+
To learn how to attach a data disk to a VM, see our article on the subject: [Attach a data disk to a Windows VM with PowerShell](attach-disk-ps.md). To use the disk as the OS disk, see [Create a Windows VM from a specialized disk](create-vm-specialized.md#create-the-new-vm).

0 commit comments

Comments
 (0)