Skip to content

Commit e5da8cf

Browse files
author
Sam Lee
committed
Small bug fix
1 parent 023569b commit e5da8cf

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,10 @@ function New-AzMigrateLocalDiskMappingObject {
7474
process {
7575
$isDynamicDisk = [System.Convert]::ToBoolean($IsDynamic)
7676
$osDisk = [System.Convert]::ToBoolean($IsOSDisk)
77+
$hasPhysicalSectorSize = $PSBoundParameters.ContainsKey('PhysicalSectorSize')
7778

78-
if ($Format -eq "VHD" -and $PhysicalSectorSize -ne 512) {
79-
throw "PhysicalSectorSize must be 512 for VHD format."
79+
if ($Format -eq "VHD" -and $hasPhysicalSectorSize -and $PhysicalSectorSize -ne 512) {
80+
throw "PhysicalSectorSize must be 512 for VHD format but $PhysicalSectorSize is given."
8081
}
8182

8283
$DiskObject = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20240901.AzLocalDiskInput]::new(

0 commit comments

Comments
 (0)