Skip to content

Commit f08893a

Browse files
author
Sam Lee
committed
Fix VHD with Gen2 for datadisk logic
1 parent e5da8cf commit f08893a

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
@@ -663,9 +663,9 @@ function New-AzMigrateLocalServerReplication {
663663
# Validate DiskToInclude
664664
[PSCustomObject[]]$uniqueDisks = @()
665665
foreach ($disk in $DiskToInclude) {
666-
# VHD is not supported in Gen2 VMs
667-
if ($customProperties.HyperVGeneration -eq "2" -and $disk.DiskFileFormat -eq "VHD") {
668-
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."
666+
# VHD is not supported as OS disk in Gen2 VMs
667+
if ($customProperties.HyperVGeneration -eq "2" -and $disk.DiskFileFormat -eq "VHD" -and $disk.IsOSDisk) {
668+
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."
669669
}
670670

671671
# PhysicalSectorSize must be 512 for VHD format

0 commit comments

Comments
 (0)