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
+37-2Lines changed: 37 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -54,7 +54,6 @@ function _GetScenarioBackendType {
54
54
}
55
55
}
56
56
57
-
58
57
If (($backendMemberTypes|Sort-Object|Get-Unique).count -gt1) {
59
58
log -ErrorAction Stop -Message "[Test-SupportedMigrationScenario] Basic Load Balancer backend pools can contain only VMs or VMSSes, contains: '$($backendMemberTypes-join',')'"-Severity 'Error'
60
59
return
@@ -69,7 +68,43 @@ function _GetScenarioBackendType {
log -Message "[Test-SupportedMigrationScenario] Basic Load Balancer backend pools are empty"
72
-
$backendType='Empty'
71
+
72
+
# check that there are no VMSSes associated with the Basic Load Balancer which have no instances
73
+
log -Message "[Test-SupportedMigrationScenario] Checking if there are any VMSSes associated with the Basic Load Balancer but which have no instances..."
74
+
$graphQuery=@"
75
+
resources
76
+
| where type =~ 'microsoft.compute/virtualmachinescalesets' and location =~ '$($BasicLoadBalancer.Location)'
77
+
| where tostring(properties.virtualMachineProfile.networkProfile.networkInterfaceConfigurations) has '$($BasicLoadBalancer.id)'
} while ($associatedVMSSCount.count-eq0-and$env:LBMIG_WAIT_FOR_ARG-and$timeoutStopwatch.Elapsed.Minutes-lt15)
97
+
98
+
If ($timeoutStopwatch.Elapsed.Minutes-gt15) {
99
+
log -Severity Error -Message "[Test-SupportedMigrationScenario] Resource Graph query timed out before results were returned! The Resource Graph lags behind ARM by several minutes--if the resources to migrate were just created (as in a test), test the query from the log to determine if this was an ingestion lag or synax failure. Once the issue has been corrected, follow the documented migration recovery steps here: https://learn.microsoft.com/azure/load-balancer/upgrade-basic-standard-virtual-machine-scale-sets#what-happens-if-my-upgrade-fails-mid-migration"-terminateOnError
100
+
}
101
+
102
+
If ($associatedVMSSCount.vmssCount-gt0) {
103
+
log -Message "[Test-SupportedMigrationScenario] Basic Load Balancer has a VMSS associated with it which has no instances. This scenario is not currently supported. WORKAROUND: scale your VMSS to at least one instance or remove the VMSS from the LB in the VMSS profile."-Severity 'Error'-terminateOnError
104
+
}
105
+
Else {
106
+
$backendType='Empty'
107
+
}
73
108
}
74
109
Else {
75
110
log -ErrorAction Stop -Message "[Test-SupportedMigrationScenario] Basic Load Balancer backend pools can contain only VMs or VMSSes, contains: '$($backendMemberTypes-join',')'"-Severity 'Error'
0 commit comments