|
| 1 | +--- |
| 2 | +title: Upgrade from Basic to Standard for Virtual Machine Scale Sets |
| 3 | +titleSuffix: Azure Load Balancer |
| 4 | +description: This article shows you how to upgrade a load balancer from basic to standard SKU for Virtual Machine Scale Sets. |
| 5 | +services: load-balancer |
| 6 | +author: Welasco |
| 7 | +ms.service: load-balancer |
| 8 | +ms.topic: how-to |
| 9 | +ms.date: 09/22/2022 |
| 10 | +ms.author: vsantana |
| 11 | +--- |
| 12 | +# Upgrade a basic load balancer used with Virtual Machine Scale Sets |
| 13 | +[Azure Standard Load Balancer](load-balancer-overview.md) offers a rich set of functionality and high availability through zone redundancy. To learn more about Load Balancer SKU, see [comparison table](./skus.md#skus). |
| 14 | + |
| 15 | +This article introduces a PowerShell module that creates a Standard Load Balancer with the same configuration as the Basic Load Balancer along with the associated Virtual Machine Scale Set. |
| 16 | + |
| 17 | +## Upgrade Overview |
| 18 | + |
| 19 | +An Azure PowerShell module is available to upgrade from Basic load balancer to a Standard load balancer along with moving the associated Virtual Machine Scale set (VMSS). The PowerShell module performs the following functions: |
| 20 | + |
| 21 | +- Verifies that the provided Basic load balancer scenario is supported for upgrade. |
| 22 | +- Backs up the Basic load balancer and Virtual Machine Scale set (VMSS) configuration, enabling retry on failure or if errors are encountered. |
| 23 | +- For public load balancers, updates the front end public IP address(es) to Standard SKU and static assignment as required. |
| 24 | +- Upgrade the Basic load balancer configuration to a new Standard load balancer, ensuring configuration and feature parity. |
| 25 | +- Upgrade VMSS backend pool members from the Basic load balancer to the standard load balancer. |
| 26 | +- Creates and associates a NSG with the VMSS to ensure load balanced traffic reaches backend pool members, following Standard load balancer's move to a default-deny network policy. |
| 27 | +- Logs the upgrade operation for easy audit and failure recovery. |
| 28 | + |
| 29 | +### Unsupported Scenarios |
| 30 | + |
| 31 | +- Basic load balancers with a VMSS backend pool member which is also a member of a backend pool on a different load balancer |
| 32 | +- Basic load balancers with backend pool members which are not a VMSS |
| 33 | +- Basic load balancers with only empty backend pools |
| 34 | +- Basic load balancers with IPV6 frontend IP configurations |
| 35 | +- Basic load balancers with a VMSS backend pool member configured with 'Flexible' orchestration mode |
| 36 | +- Basic load balancers with a VMSS backend pool member where one or more VMSS instances have ProtectFromScaleSetActions Instance Protection policies enabled |
| 37 | +- Migrating a Basic load balancer to an existing Standard load balancer |
| 38 | + |
| 39 | +### Prerequisites |
| 40 | + |
| 41 | +- Install the latest version of [PowerShell Desktop or Core ](/powershell/scripting/install/installing-powershell) |
| 42 | +- Determine whether you have the latest Az module installed (8.2.0) |
| 43 | + - Install the latest Az PowerShell module](/powershell/azure/install-az-ps) |
| 44 | + |
| 45 | +## Install the 'AzureBasicLoadBalancerUpgrade' module |
| 46 | + |
| 47 | +Install the module from [PowerShell gallery](https://www.powershellgallery.com/packages/AzureBasicLoadBalancerUpgrade/0.1.0) |
| 48 | + |
| 49 | +```powershell |
| 50 | +PS C:\> Install-Module -Name AzureBasicLoadBalancerUpgrade -Scope CurrentUser -Repository PSGallery -Force |
| 51 | +``` |
| 52 | + |
| 53 | +## Use the module |
| 54 | + |
| 55 | +1. Use `Connect-AzAccount` to connect to the required Azure AD tenant and Azure subscription |
| 56 | + |
| 57 | + ```powershell |
| 58 | + PS C:\> Connect-AzAccount -Tenant <TenantId> -Subscription <SubscriptionId> |
| 59 | + ``` |
| 60 | +
|
| 61 | +2. Find the Load Balancer you wish to upgrade. Record its name and resource group name. |
| 62 | +
|
| 63 | +3. Examine the module parameters: |
| 64 | + - *BasicLoadBalancerName [string] Required* - This parameter is the name of the existing Basic load balancer you would like to upgrade |
| 65 | + - *ResourceGroupName [string] Required* - This parameter is the name of the resource group containing the Basic load balancer |
| 66 | + - *RecoveryBackupPath [string] Optional* - This parameter allows you to specify an alternative path in which to store the Basic load balancer ARM template backup file (defaults to the current working directory) |
| 67 | + - *FailedMigrationRetryFilePathLB [string] Optional* - This parameter allows you to specify a path to a Basic load balancer backup state file when retrying a failed upgrade (defaults to current working directory) |
| 68 | + - *FailedMigrationRetryFilePathVMSS [string] Optional* - This parameter allows you to specify a path to a Virtual Machine Scale set (VMSS) backup state file when retrying a failed upgrade (defaults to current working directory) |
| 69 | +
|
| 70 | +4. Run the Upgrade command. |
| 71 | +
|
| 72 | +### Example: upgrade a basic load balancer to a standard load balancer with the same name, providing the basic load balancer name and resource group |
| 73 | +
|
| 74 | +```powershell |
| 75 | +PS C:\> Start-AzBasicLoadBalancerUpgrade -ResourceGroupName <load balancer resource group name> -BasicLoadBalancerName <existing basic load balancer name> |
| 76 | +``` |
| 77 | + |
| 78 | +### Example: upgrade a basic load balancer to a standard load balancer with the same name, providing the basic load object through the pipeline |
| 79 | + |
| 80 | +```powershell |
| 81 | +PS C:\> Get-AzLoadBalancer -Name <basic load balancer name> -ResourceGroup <Basic load balancer resource group name> | Start-AzBasicLoadBalancerUpgrade |
| 82 | +``` |
| 83 | + |
| 84 | +### Example: upgrade a basic load balancer to a standard load balancer with the specified name, displaying logged output on screen |
| 85 | + |
| 86 | +```powershell |
| 87 | +PS C:\> Start-AzBasicLoadBalancerUpgrade -ResourceGroupName <load balancer resource group name> -BasicLoadBalancerName <existing basic load balancer name> -StandardLoadBalancerName <new standard load balancer name> -FollowLog |
| 88 | +``` |
| 89 | + |
| 90 | +### Example: upgrade a basic load balancer to a standard load balancer with the specified name and store the basic load balancer backup file at the specified path |
| 91 | + |
| 92 | +```powershell |
| 93 | +PS C:\> Start-AzBasicLoadBalancerUpgrade -ResourceGroupName <load balancer resource group name> -BasicLoadBalancerName <existing basic load balancer name> -StandardLoadBalancerName <new standard load balancer name> -RecoveryBackupPath C:\BasicLBRecovery |
| 94 | +``` |
| 95 | + |
| 96 | +### Example: retry a failed upgrade (due to error or script termination) by providing the Basic load balancer and VMSS backup state file |
| 97 | + |
| 98 | +```powerhsell |
| 99 | +PS C:\> Start-AzBasicLoadBalancerMigration -FailedMigrationRetryFilePathLB C:\RecoveryBackups\State_mybasiclb_rg-basiclbrg_20220912T1740032148.json -FailedMigrationRetryFilePathVMSS C:\RecoveryBackups\VMSS_myVMSS_rg-basiclbrg_20220912T1740032148.json |
| 100 | +``` |
| 101 | + |
| 102 | +## Common Questions |
| 103 | + |
| 104 | +### Will the module migrate my frontend IP address to the new Standard load balancer? |
| 105 | + |
| 106 | +Yes, for both public and internal load balancers, the module ensures that front end IP addresses are maintained. For public IPs, the IP is converted to a static IP prior to migration (if necessary). For internal front ends, the module will attempt to reassign the same IP address freed up when the Basic load balancer was deleted; if the private IP is not available the script will fail. In this scenario, remove the virtual network connected device which has claimed the intended front end IP and rerun the module with the `-FailedMigrationRetryFilePathLB <BasicLoadBalancerbackupFilePath> -FailedMigrationRetryFilePathVMSS <VMSSBackupFile>` parameters specified. |
| 107 | + |
| 108 | +### How long does the Upgrade take? |
| 109 | + |
| 110 | +It usually takes a few minutes for the script to finish and it could take longer depending on the complexity of your load balancer configuration, number of backend pool members, and instance count of associated Virtual Machine Scale Sets. Keep the downtime in mind and plan for failover if necessary. |
| 111 | + |
| 112 | +### Does the script migrate my backend pool members from my basic load balancer to the newly created standard load balancer? |
| 113 | + |
| 114 | +Yes. The Azure PowerShell script migrates the virtual machine scale set to the newly created public or private standard load balancer. |
| 115 | + |
| 116 | +### Which load balancer components are migrated? |
| 117 | + |
| 118 | +The script migrates the following from the Basic load balancer to the Standard load balancer: |
| 119 | + |
| 120 | +**Public Load Balancer:** |
| 121 | + |
| 122 | +- Public frontend IP configuration |
| 123 | + - Converts the public IP to a static IP, if dynamic |
| 124 | + - Updates the public IP SKU to Standard, if Basic |
| 125 | + - Upgrade all associated public IPs to the new Standard load balancer |
| 126 | +- Health Probes: |
| 127 | + - All probes will be migrated to the new Standard load balancer |
| 128 | +- Load balancing rules: |
| 129 | + - All load balancing rules will be migrated to the new Standard load balancer |
| 130 | +- Inbound NAT Rules: |
| 131 | + - All NAT rules will be migrated to the new Standard load balancer |
| 132 | +- Outbound Rules: |
| 133 | + - Basic load balancers do not support configured outbound rules. The script will create an outbound rule in the Standard load balancer to preserve the outbound behavior of the Basic load balancer. For more information about Outbound connectivity, see [Outbound-only load balancer configuration](/azure/load-balancer/egress-only). |
| 134 | +- Network Security Group |
| 135 | + - Basic load balancer doesn't required a Network Security Group to allow outbound connectivity. In case there is no Network Security Group associated with the VMSS, a new NSG will be created to preserve the same functionality. This new NSG will be associated to the VMSS backend pool member network interfaces and allow the same load balancing rules ports and protocols and preserve the outbound connectivity. |
| 136 | +- Backend pools: |
| 137 | + - All backend pools will be migrated to the new Standard load balancer |
| 138 | + - All VMSS network interfaces and IP configurations will be migrated to the new Standard load balancer |
| 139 | + - In case of VMSS using Rolling Upgrade policy, the script will update the VMSS upgrade policy to "Manual" during the migration process and revert it back to "Rolling" after the migration is completed. |
| 140 | + |
| 141 | +**Private Load Balancer:** |
| 142 | + |
| 143 | +- Private frontend IP configuration |
| 144 | + - Converts the public IP to a static IP, if dynamic |
| 145 | + - Updates the public IP SKU to Standard, if Basic |
| 146 | +- Health Probes: |
| 147 | + - All probes will be migrated to the new Standard load balancer |
| 148 | +- Load balancing rules: |
| 149 | + - All load balancing rules will be migrated to the new Standard load balancer |
| 150 | +- Inbound NAT Rules: |
| 151 | + - All NAT rules will be migrated to the new Standard load balancer |
| 152 | +- Backend pools: |
| 153 | + - All backend pools will be migrated to the new Standard load balancer |
| 154 | + - All VMSS network interfaces and IP configurations will be migrated to the new Standard load balancer |
| 155 | + - In case of VMSS using Rolling Upgrade policy, the script will update the VMSS upgrade policy to "Manual" during the migration process and revert it back to "Rolling" after the migration is completed. |
| 156 | + |
| 157 | +### What happens if my upgrade fails mid-migration? |
| 158 | + |
| 159 | +The module is designed to accommodate failures, either due to unhandled errors or unexpected script termination. The failure design is a 'fail forward' approach, where instead of attempting to move back to the Basic load balancer, you should correct the issue causing the failure (see the error output or log file), and retry the migration again, specifying the `-FailedMigrationRetryFilePathLB <BasicLoadBalancerbackupFilePath> -FailedMigrationRetryFilePathVMSS <VMSSBackupFile>` parameters. For public load balancers, because the Public IP Address SKU has been updated to Standard, moving the same IP back to a Basic load balancer will not be possible. The basic failure recovery procedure is: |
| 160 | + |
| 161 | + 1. Address the cause of the migration failure. Check the log file `Start-AzBasicLoadBalancerUpgrade.log` for details |
| 162 | + 1. [Remove the new Standard load balancer](/azure/load-balancer/update-load-balancer-with-vm-scale-set) (if created). Depending on which stage of the migration failed, you may have to remove the Standard load balancer reference from the VMSS network interfaces (IP configurations) and health probes in order to remove the Standard load balancer and try again. |
| 163 | + 1. Locate the basic load balancer state backup file. This will either be in the directory where the script was executed, or at the path specified with the `-RecoveryBackupPath` parameter during the failed execution. The file will be named: `State_<basicLBName>_<basicLBRGName>_<timestamp>.json` |
| 164 | + 1. Rerun the migration script, specifying the `-FailedMigrationRetryFilePathLB <BasicLoadBalancerbackupFilePath> -FailedMigrationRetryFilePathVMSS <VMSSBackupFile>` parameters instead of -BasicLoadBalancerName or passing the Basic load balancer over the pipeline |
| 165 | + |
| 166 | +## Next Steps |
| 167 | + |
| 168 | +[Learn about the Azure Load Balancer](/azure/load-balancer/load-balancer-overview) |
| 169 | + |
| 170 | +## Next steps |
| 171 | + |
| 172 | +[Learn about Azure Load Balancer](load-balancer-overview.md) |
0 commit comments