|
| 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. 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 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 virtual machine scale set backend pool members from the Basic load balancer to the standard load balancer. |
| 26 | +- Creates and associates a network security group with the virtual machine scale set 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 virtual machine scale set backend pool member that is also a member of a backend pool on a different load balancer |
| 32 | +- Basic load balancers with backend pool members that aren't a virtual machine scale set |
| 33 | +- Basic load balancers with only empty backend pools |
| 34 | +- Basic load balancers with IPV6 frontend IP configurations |
| 35 | +- Basic load balancers with a virtual machine scale set backend pool member configured with 'Flexible' orchestration mode |
| 36 | +- Basic load balancers with a virtual machine scale set backend pool member where one or more virtual machine scale set 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](/powershell/scripting/install/installing-powershell) |
| 42 | +- Determine whether you have the latest Az PowerShell 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) |
| 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 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 virtual machine scale set backup state file |
| 97 | + |
| 98 | +```powerhsell |
| 99 | +PS C:\> Start-AzBasicLoadBalancerUpgrade -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 isn't available the script will fail. In this scenario, remove the virtual network connected device that 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 | +The upgrade normally takes a few minutes for the script to finish. The following factors may lead to longer upgrade times: |
| 111 | +- Complexity of your load balancer configuration |
| 112 | +- Number of backend pool members |
| 113 | +- Instance count of associated Virtual Machine Scale Sets. |
| 114 | +Keep the downtime in mind and plan for failover if necessary. |
| 115 | + |
| 116 | +### Does the script migrate my backend pool members from my basic load balancer to the newly created standard load balancer? |
| 117 | + |
| 118 | +Yes. The Azure PowerShell script migrates the virtual machine scale set to the newly created public or private standard load balancer. |
| 119 | + |
| 120 | +### Which load balancer components are migrated? |
| 121 | + |
| 122 | +The script migrates the following from the Basic load balancer to the Standard load balancer: |
| 123 | + |
| 124 | +**Public Load Balancer:** |
| 125 | + |
| 126 | +- Public frontend IP configuration |
| 127 | + - Converts the public IP to a static IP, if dynamic |
| 128 | + - Updates the public IP SKU to Standard, if Basic |
| 129 | + - Upgrade all associated public IPs to the new Standard load balancer |
| 130 | +- Health Probes: |
| 131 | + - All probes will be migrated to the new Standard load balancer |
| 132 | +- Load balancing rules: |
| 133 | + - All load balancing rules will be migrated to the new Standard load balancer |
| 134 | +- Inbound NAT Rules: |
| 135 | + - All NAT rules will be migrated to the new Standard load balancer |
| 136 | +- Outbound Rules: |
| 137 | + - Basic load balancers don't 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 rules, see [Outbound rules](/azure/load-balancer/outbound-rules). |
| 138 | +- Network security group |
| 139 | + - Basic load balancer doesn't require a network security group to allow outbound connectivity. In case there's no network security group associated with the virtual machine scale set, a new network security group will be created to preserve the same functionality. This new network security group will be associated to the virtual machine scale set backend pool member network interfaces. It will allow the same load balancing rules ports and protocols and preserve the outbound connectivity. |
| 140 | +- Backend pools: |
| 141 | + - All backend pools will be migrated to the new Standard load balancer |
| 142 | + - All virtual machine scale set network interfaces and IP configurations will be migrated to the new Standard load balancer |
| 143 | + - If a virtual machine scale set is using Rolling Upgrade policy, the script will update the virtual machine scale set upgrade policy to "Manual" during the migration process and revert it back to "Rolling" after the migration is completed. |
| 144 | + |
| 145 | +**Internal Load Balancer:** |
| 146 | + |
| 147 | +- Private frontend IP configuration |
| 148 | + - Converts the public IP to a static IP, if dynamic |
| 149 | + - Updates the public IP SKU to Standard, if Basic |
| 150 | +- Health Probes: |
| 151 | + - All probes will be migrated to the new Standard load balancer |
| 152 | +- Load balancing rules: |
| 153 | + - All load balancing rules will be migrated to the new Standard load balancer |
| 154 | +- Inbound NAT Rules: |
| 155 | + - All NAT rules will be migrated to the new Standard load balancer |
| 156 | +- Backend pools: |
| 157 | + - All backend pools will be migrated to the new Standard load balancer |
| 158 | + - All virtual machine scale set network interfaces and IP configurations will be migrated to the new Standard load balancer |
| 159 | + - If there's a virtual machine scale set using Rolling Upgrade policy, the script will update the virtual machine scale set upgrade policy to "Manual" during the migration process and revert it back to "Rolling" after the migration is completed. |
| 160 | + |
| 161 | +>[!NOTE] |
| 162 | +> Network security group are not configured as part of Internal Load Balancer upgrade. To learn more about NSGs, see [Network security groups](/azure/virtual-network/network-security-groups-overview) |
| 163 | +
|
| 164 | +### What happens if my upgrade fails mid-migration? |
| 165 | + |
| 166 | +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 won't be possible. The basic failure recovery procedure is: |
| 167 | + |
| 168 | + 1. Address the cause of the migration failure. Check the log file `Start-AzBasicLoadBalancerUpgrade.log` for details |
| 169 | + 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 virtual machine scale set network interfaces (IP configurations) and health probes in order to remove the Standard load balancer and try again. |
| 170 | + 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` |
| 171 | + 1. Rerun the migration script, specifying the `-FailedMigrationRetryFilePathLB <BasicLoadBalancerbackupFilePath> -FailedMigrationRetryFilePathVMSS <VMSSBackupFile>` parameters instead of -BasicLoadBalancerName or passing the Basic load balancer over the pipeline |
| 172 | + |
| 173 | +## Next steps |
| 174 | + |
| 175 | +[Learn about Azure Load Balancer](load-balancer-overview.md) |
0 commit comments