You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: AzureBasicLoadBalancerUpgrade/module/AzureBasicLoadBalancerUpgrade/modules/ValidateScenario/ValidateScenario.psm1
+78-39Lines changed: 78 additions & 39 deletions
Original file line number
Diff line number
Diff line change
@@ -79,6 +79,31 @@ function _GetScenarioBackendType {
log -ErrorAction Stop -Severity 'Error'-Message "[Test-SupportedMigrationScenario] Load balancer '$($BasicLoadBalancer.Name)' backend pool member network interface '$($nic.id)' does not have an associated Virtual Machine. Backend pool members must be either a VMSS NIC or a NIC attached to a VM!"
log -terminateOnError -Severity 'Error'-Message "[Test-SupportedMigrationScenario] Error getting VM from NIC '$($nic.id)'. Error: $($_.Exception.Message)"
101
+
}
102
+
103
+
return$vm,$nic
104
+
}
105
+
}
106
+
82
107
FunctionTest-SupportedMigrationScenario {
83
108
[CmdletBinding()]
84
109
param (
@@ -406,29 +431,65 @@ Function Test-SupportedMigrationScenario {
406
431
# create array of VMs associated with the load balancer for following checks and verify that NICs are associated to VMs
log -ErrorAction Stop -Severity 'Error'-Message "[Test-SupportedMigrationScenario] Load balancer '$($BasicLoadBalancer.Name)' backend pool member network interface '$($nic.id)' does not have an associated Virtual Machine. Backend pool members must be either a VMSS NIC or a NIC attached to a VM!"
log -terminateOnError -Severity 'Error'-Message "[Test-SupportedMigrationScenario] Error getting VM from NIC '$($nic.id)'. Error: $($_.Exception.Message)"
424
-
}
425
453
426
-
# add VM nics to array for later validation
427
-
$basicLBVMNics+=$nic
454
+
$basicLBVMs+=$vm
455
+
$basicLBVMNics+=$nic
456
+
}
457
+
}
458
+
459
+
# check if LB backend VMs does not have public IPs
460
+
log -Message "[Test-SupportedMigrationScenario] Checking if backend VMs have public IPs..."
# check that all NAT Rule associated VMs are also in backend pools for external LBs
482
+
log -Message "[Test-SupportedMigrationScenario] Checking that all NAT Rule associated VMs are also in backend pools for external LBs or have Public IPs"
483
+
If ($scenario.ExternalOrInternal-eq'External'-and$natRuleOnlyVMs-and!$AllVMsHavePublicIPs) {
484
+
485
+
$message="[Test-SupportedMigrationScenario] The following VMs are associated with Inbound NAT Rules but not in the backend pool of the Basic Load Balancer: '$($natRuleOnlyVMs.Id-join', ')' and not all VMs have Public IP addresses. All NAT Rule associated VMs must have public IPs associated or be in the backend pool of the Basic Load Balancer to have outbound network connectivity post-migration. Either add Public IPs to all VMs or re-run with the -Force parameter and configure outbound connectivity post-migration."
log -Message "[Test-SupportedMigrationScenario] -Force or -ValidateOnly parameter was used, so continuing with migration validation"
490
+
}
491
+
}
492
+
432
493
# check if load balancer backend pool contains VMs which are part of another LBs backend pools
433
494
log -Message "[Test-SupportedMigrationScenario] Checking if backend pools contain members which are members of another load balancer's backend pools..."
434
495
@@ -464,28 +525,6 @@ Function Test-SupportedMigrationScenario {
464
525
log -Message "[Test-SupportedMigrationScenario] All VM load balancer associations are with the Basic LB(s) to be migrated."-Severity Information
465
526
}
466
527
467
-
# check if internal LB backend VMs does not have public IPs
468
-
log -Message "[Test-SupportedMigrationScenario] Checking if backend VMs have public IPs..."
# check if some backend VMs have ILIPs but not others
490
529
If ($AnyVMsHavePublicIP-and!$AllVMsHavePublicIPs-and$Scenario.ExternalOrInternal-eq'External') {
491
530
$message="[Test-SupportedMigrationScenario] Some but not all load balanced VMs have instance-level Public IP addresses and the load balancer is external. It is not supported to create an Outbound rule on a LB when any backend VM has a PIP; therefore, VMs which do not have PIPs will loose outbound internet connecticity post-migration."
@@ -580,7 +619,7 @@ Function Test-SupportedMigrationScenario {
580
619
}
581
620
582
621
# check if backend VMs are part of an Availability Set and if there are other members of the same availability set which are not part of the load balancer backend pool or inbound nat pools
583
-
log -Message "[Test-SupportedMigrationScenario] Checking if backend VMs are part of an Availability Set and if there are other members of the same availability set which are not part of the load balancer backend pool..."
622
+
log -Message "[Test-SupportedMigrationScenario] Checking if backend VMs are part of an Availability Set and if there are other members of the same availability set which are not part of the load balancer backend pool, NAT pool, or associated with NAT Rules..."
$message="[Test-SupportedMigrationScenario] VMs ('$($extraAvailabilitySetVMs-join';')') are part of an Availability Set and there are other members of the same Availability Set which are part of the load balancer backend pools. This is not supported for migration. To work around this, create a new backend pool on the basic LB which is not associated with a load balancing rule and add the extra VMs to it temporarily, then retry migration."
632
+
$message="[Test-SupportedMigrationScenario] VMs ('$($extraAvailabilitySetVMs-join';')') belong(s) to an Availability Set and there are other members of the same Availability Set which are part of the load balancer backend pools, NAT pools, or associated with NAT Rules. This is not supported for migration. To work around this, create a new backend pool on the basic LB which is not associated with a load balancing rule and add the extra VMs to it temporarily, then retry migration."
0 commit comments