Skip to content

Commit 89517c7

Browse files
author
Sam Lee
committed
Fix VHD with Gen2 for datadisk logic
1 parent 469e77b commit 89517c7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Migrate/Migrate.Autorest/custom/New-AzMigrateLocalServerReplication.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -593,9 +593,9 @@ function New-AzMigrateLocalServerReplication {
593593
# Validate DiskToInclude
594594
[PSCustomObject[]]$uniqueDisks = @()
595595
foreach ($disk in $DiskToInclude) {
596-
# VHD is not supported in Gen2 VMs
597-
if ($customProperties.HyperVGeneration -eq "2" -and $disk.DiskFileFormat -eq "VHD") {
598-
throw "VHD disks are not supported in Hyper-V Generation 2 VMs. Please replace disk with id '$($disk.DiskId)' in -DiskToInclude by re-running New-AzMigrateLocalDiskMappingObject with 'VHDX' as Format."
596+
# VHD is not supported as OS disk in Gen2 VMs
597+
if ($customProperties.HyperVGeneration -eq "2" -and $disk.DiskFileFormat -eq "VHD" -and $disk.IsOSDisk) {
598+
throw "VHD disks cannot be used as the OS disk of Hyper-V Generation 2 VMs. Please replace disk with id '$($disk.DiskId)' in -DiskToInclude by re-running New-AzMigrateLocalDiskMappingObject with 'VHDX' as Format."
599599
}
600600

601601
# PhysicalSectorSize must be 512 for VHD format

0 commit comments

Comments
 (0)