|
| 1 | +--- |
| 2 | +title: 'Quickstart: Create a basic public load balancer - Azure portal' |
| 3 | +titleSuffix: Azure Load Balancer |
| 4 | +description: Learn how to create a public basic SKU Azure Load Balancer in this quickstart. |
| 5 | +author: asudbring |
| 6 | +ms.author: allensu |
| 7 | +ms.service: load-balancer |
| 8 | +ms.topic: quickstart |
| 9 | +ms.date: 03/15/2022 |
| 10 | +ms.custom: template-quickstart |
| 11 | +--- |
| 12 | + |
| 13 | +# Quickstart: Create a basic public load balancer using the Azure portal |
| 14 | + |
| 15 | +Get started with Azure Load Balancer by using the Azure portal to create a basic public load balancer and two virtual machines. |
| 16 | + |
| 17 | +## Prerequisites |
| 18 | + |
| 19 | +- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F). |
| 20 | + |
| 21 | +>[!NOTE] |
| 22 | +>Standard SKU load balancer is recommended for production workloads. For more information about SKUs, see **[Azure Load Balancer SKUs](../skus.md)**. |
| 23 | +
|
| 24 | +## Sign in to Azure |
| 25 | + |
| 26 | +Sign in to the Azure portal at [https://portal.azure.com](https://portal.azure.com). |
| 27 | + |
| 28 | +## Create the virtual network |
| 29 | + |
| 30 | +In this section, you'll create a virtual network and subnet. |
| 31 | + |
| 32 | +1. In the search box at the top of the portal, enter **Virtual network**. Select **Virtual Networks** in the search results. |
| 33 | + |
| 34 | +2. In **Virtual networks**, select **+ Create**. |
| 35 | + |
| 36 | +3. In **Create virtual network**, enter or select the following information in the **Basics** tab: |
| 37 | + |
| 38 | + | **Setting** | **Value** | |
| 39 | + |------------------|-----------------------------------------------------------------| |
| 40 | + | **Project Details** | | |
| 41 | + | Subscription | Select your Azure subscription | |
| 42 | + | Resource Group | Select **Create new**. </br> In **Name** enter **CreatePubLBQS-rg**. </br> Select **OK**. | |
| 43 | + | **Instance details** | | |
| 44 | + | Name | Enter **myVNet** | |
| 45 | + | Region | Select **West US 3** | |
| 46 | + |
| 47 | +4. Select the **IP Addresses** tab or select the **Next: IP Addresses** button at the bottom of the page. |
| 48 | + |
| 49 | +5. In the **IP Addresses** tab, enter this information: |
| 50 | + |
| 51 | + | Setting | Value | |
| 52 | + |--------------------|----------------------------| |
| 53 | + | IPv4 address space | Enter **10.1.0.0/16** | |
| 54 | + |
| 55 | +6. Under **Subnet name**, select the word **default**. |
| 56 | + |
| 57 | +7. In **Edit subnet**, enter the following information: |
| 58 | + |
| 59 | + | Setting | Value | |
| 60 | + |--------------------|----------------------------| |
| 61 | + | Subnet name | Enter **myBackendSubnet** | |
| 62 | + | Subnet address range | Enter **10.1.0.0/24** | |
| 63 | + |
| 64 | +8. Select **Save**. |
| 65 | + |
| 66 | +9. Select the **Security** tab. |
| 67 | + |
| 68 | +10. Under **BastionHost**, select **Enable**. Enter this information: |
| 69 | + |
| 70 | + | Setting | Value | |
| 71 | + |--------------------|----------------------------| |
| 72 | + | Bastion name | Enter **myBastionHost** | |
| 73 | + | AzureBastionSubnet address space | Enter **10.1.1.0/27** | |
| 74 | + | Public IP Address | Select **Create new**. </br> For **Name**, enter **myBastionIP**. </br> Select **OK**. | |
| 75 | + |
| 76 | + |
| 77 | +11. Select the **Review + create** tab or select the **Review + create** button. |
| 78 | + |
| 79 | +12. Select **Create**. |
| 80 | + |
| 81 | +## Create load balancer |
| 82 | + |
| 83 | +In this section, you create a load balancer that load balances virtual machines. |
| 84 | + |
| 85 | +During the creation of the load balancer, you'll configure: |
| 86 | + |
| 87 | +* Frontend IP address |
| 88 | +* Backend pool |
| 89 | +* Inbound load-balancing rules |
| 90 | + |
| 91 | +1. In the search box at the top of the portal, enter **Load balancer**. Select **Load balancers** in the search results. |
| 92 | + |
| 93 | +2. In the **Load balancer** page, select **+ Create**. |
| 94 | + |
| 95 | +3. In the **Basics** tab of the **Create load balancer** page, enter, or select the following information: |
| 96 | + |
| 97 | + | Setting | Value | |
| 98 | + | --- | --- | |
| 99 | + | **Project details** | | |
| 100 | + | Subscription | Select your subscription. | |
| 101 | + | Resource group | Select **CreatePubLBQS-rg**. | |
| 102 | + | **Instance details** | | |
| 103 | + | Name | Enter **myLoadBalancer** | |
| 104 | + | Region | Select **West US 3**. | |
| 105 | + | SKU | Select **Basic**. | |
| 106 | + | Type | Select **Public**. | |
| 107 | + |
| 108 | +4. Select **Next: Frontend IP configuration** at the bottom of the page. |
| 109 | + |
| 110 | +5. In **Frontend IP configuration**, select **+ Add a frontend IP**. |
| 111 | + |
| 112 | +6. Enter **myFrontend** in **Name**. |
| 113 | + |
| 114 | +7. Select **IPv4** or **IPv6** for the **IP version**. |
| 115 | + |
| 116 | +8. Select **Create new** in **Public IP address**. |
| 117 | + |
| 118 | +9. In **Add a public IP address**, enter **myPublicIP** for **Name**. |
| 119 | + |
| 120 | +10. In **Assignment**, select **Static**. |
| 121 | + |
| 122 | +11. Select **OK**. |
| 123 | + |
| 124 | +12. Select **Add**. |
| 125 | + |
| 126 | +13. Select **Next: Backend pools** at the bottom of the page. |
| 127 | + |
| 128 | +14. In the **Backend pools** tab, select **+ Add a backend pool**. |
| 129 | + |
| 130 | +15. Enter or select the following information in **Add backend pool**. |
| 131 | + |
| 132 | + | Setting | Value | |
| 133 | + | ------- | ----- | |
| 134 | + | Name | Enter **myBackendPool**. | |
| 135 | + | Virtual network | Select **myVNet (CreatePubLBQS-rg)**. | |
| 136 | + | Associated to | Select **Virtual machines**. | |
| 137 | + | IP version | Select **IPv4** or **IPv6**. | |
| 138 | + |
| 139 | +16. Select **Add**. |
| 140 | + |
| 141 | +17. Select the **Next: Inbound rules** button at the bottom of the page. |
| 142 | + |
| 143 | +18. In **Load balancing rule** in the **Inbound rules** tab, select **+ Add a load balancing rule**. |
| 144 | + |
| 145 | +19. In **Add load balancing rule**, enter or select the following information: |
| 146 | + |
| 147 | + | Setting | Value | |
| 148 | + | ------- | ----- | |
| 149 | + | Name | Enter **myHTTPRule** | |
| 150 | + | IP Version | Select **IPv4** or **IPv6** depending on your requirements. | |
| 151 | + | Frontend IP address | Select **myFrontend**. | |
| 152 | + | Backend pool | Select **myBackendPool**. | |
| 153 | + | Protocol | Select **TCP**. | |
| 154 | + | Port | Enter **80**. | |
| 155 | + | Backend port | Enter **80**. | |
| 156 | + | Health probe | Select **Create new**. </br> In **Name**, enter **myHealthProbe**. </br> Select **TCP** in **Protocol**. </br> Leave the rest of the defaults, and select **OK**. | |
| 157 | + | Session persistence | Select **None**. | |
| 158 | + | Idle timeout (minutes) | Enter or select **15**. | |
| 159 | + | Floating IP | Select **Disabled**. | |
| 160 | + |
| 161 | +20. Select **Add**. |
| 162 | + |
| 163 | +21. Select the blue **Review + create** button at the bottom of the page. |
| 164 | + |
| 165 | +22. Select **Create**. |
| 166 | + |
| 167 | +## Create virtual machines |
| 168 | + |
| 169 | +In this section, you'll create two VMs (**myVM1** and **myVM2**). |
| 170 | + |
| 171 | +The two VMs will be added to an availability set named **myAvailabilitySet**. |
| 172 | + |
| 173 | +1. In the search box at the top of the portal, enter **Virtual machine**. Select **Virtual machines** in the search results. |
| 174 | + |
| 175 | +2. In **Virtual machines**, select **+ Create** > **Virtual machine**. |
| 176 | + |
| 177 | +3. In **Create a virtual machine**, type or select the values in the **Basics** tab: |
| 178 | + |
| 179 | + | Setting | Value | |
| 180 | + |-----------------------|----------------------------------| |
| 181 | + | **Project Details** | | |
| 182 | + | Subscription | Select your Azure subscription | |
| 183 | + | Resource Group | Select **CreatePubLBQS-rg** | |
| 184 | + | **Instance details** | | |
| 185 | + | Virtual machine name | Enter **myVM1** | |
| 186 | + | Region | Select **West US 3** | |
| 187 | + | Availability Options | Select **Availability set** | |
| 188 | + | Availability set | Select **Create new**. </br> Enter **myAvailabilitySet** in **Name**. </br> Select **OK** | |
| 189 | + | Security type | Select **Standard**. | |
| 190 | + | Image | Select **Windows Server 2022 Datacenter - Gen2** | |
| 191 | + | Azure Spot instance | Leave the default of unchecked. | |
| 192 | + | Size | Choose VM size or take default setting | |
| 193 | + | **Administrator account** | | |
| 194 | + | Username | Enter a username | |
| 195 | + | Password | Enter a password | |
| 196 | + | Confirm password | Reenter password | |
| 197 | + | **Inbound port rules** | | |
| 198 | + | Public inbound ports | Select **None**. | |
| 199 | + |
| 200 | +4. Select the **Networking** tab, or select **Next: Disks**, then **Next: Networking**. |
| 201 | + |
| 202 | +5. In the Networking tab, select or enter: |
| 203 | + |
| 204 | + | Setting | Value | |
| 205 | + |-|-| |
| 206 | + | **Network interface** | | |
| 207 | + | Virtual network | Select **myVNet** | |
| 208 | + | Subnet | Select **myBackendSubnet** | |
| 209 | + | Public IP | Select **None** | |
| 210 | + | NIC network security group | Select **Advanced**| |
| 211 | + | Configure network security group | Select **Create new**. </br> In the **Create network security group**, enter **myNSG** in **Name**. </br> Under **Inbound rules**, select **+Add an inbound rule**. </br> In **Source port ranges**, enter **80**. </br> In **Service**, select **HTTP**. </br> Under **Priority**, enter **100**. </br> In **Name**, enter **myNSGRule** </br> Select **Add** </br> Select **OK** | |
| 212 | + | **Load balancing** | | |
| 213 | + | Place this virtual machine behind an existing load-balancing solution? | Select the box | |
| 214 | + | **Load balancing settings** | | |
| 215 | + | Load balancing options | Select **Azure Load Balancer**. | |
| 216 | + | Select a load balancer | Select **myLoadBalancer**. | |
| 217 | + | Select a backend pool | Select **myBackendPool**. | |
| 218 | + |
| 219 | +6. Select **Review + create**. |
| 220 | + |
| 221 | +7. Review the settings, and then select **Create**. |
| 222 | + |
| 223 | +8. Follow the steps 1 through 7 to create one more VM with the following values and all the other settings the same as **myVM1**: |
| 224 | + |
| 225 | + | Setting | VM 2 | |
| 226 | + | ------- | ----- | |
| 227 | + | Name | **myVM2** | |
| 228 | + | Availability set | Select **myAvailabilitySet** | |
| 229 | + | Network security group | Select the existing **myNSG** | |
| 230 | + |
| 231 | +[!INCLUDE [ephemeral-ip-note.md](../../../includes/ephemeral-ip-note.md)] |
| 232 | + |
| 233 | +## Install IIS |
| 234 | + |
| 235 | +1. In the search box at the top of the portal, enter **Virtual machine**. Select **Virtual machines** in the search results. |
| 236 | + |
| 237 | +2. Select **myVM1**. |
| 238 | + |
| 239 | +3. On the **Overview** page, select **Connect**, then **Bastion**. |
| 240 | + |
| 241 | +4. Select **Use Bastion**. |
| 242 | + |
| 243 | +5. Enter the username and password entered during VM creation. |
| 244 | + |
| 245 | +6. Select **Connect**. |
| 246 | + |
| 247 | +7. On the server desktop, navigate to **Windows Administrative Tools** > **Windows PowerShell**. |
| 248 | + |
| 249 | +8. In the PowerShell Window, run the following commands to: |
| 250 | + |
| 251 | + * Install the IIS server |
| 252 | + |
| 253 | + * Remove the default iisstart.htm file |
| 254 | + |
| 255 | + * Add a new iisstart.htm file that displays the name of the VM: |
| 256 | + |
| 257 | + ```powershell |
| 258 | + # Install IIS server role |
| 259 | + Install-WindowsFeature -name Web-Server -IncludeManagementTools |
| 260 | + |
| 261 | + # Remove default htm file |
| 262 | + Remove-Item C:\inetpub\wwwroot\iisstart.htm |
| 263 | + |
| 264 | + # Add a new htm file that displays server name |
| 265 | + Add-Content -Path "C:\inetpub\wwwroot\iisstart.htm" -Value $("Hello World from " + $env:computername) |
| 266 | + ``` |
| 267 | + |
| 268 | +9. Close the bastion session with **myVM1**. |
| 269 | + |
| 270 | +10. Repeat steps 1 to 9 to install IIS and the updated iisstart.htm file on **myVM2**. |
| 271 | + |
| 272 | +## Test the load balancer |
| 273 | + |
| 274 | +1. In the search box at the top of the page, enter **Load balancer**. Select **Load balancers** in the search results. |
| 275 | + |
| 276 | +2. Find the public IP address for the load balancer on the **Overview** page under **Public IP address**. |
| 277 | + |
| 278 | +3. Copy the public IP address, and then paste it into the address bar of your browser. The custom VM page of the IIS Web server is displayed in the browser. |
| 279 | + |
| 280 | +## Clean up resources |
| 281 | + |
| 282 | +When no longer needed, delete the resource group, load balancer, and all related resources. To do so, select the resource group **CreatePubLBQS-rg** that contains the resources and then select **Delete**. |
| 283 | + |
| 284 | +## Next steps |
| 285 | + |
| 286 | +In this quickstart, you: |
| 287 | + |
| 288 | +* Created a basic public load balancer. |
| 289 | + |
| 290 | +* Attached 2 VMs to the load balancer. |
| 291 | + |
| 292 | +* Tested the load balancer. |
| 293 | + |
| 294 | +To learn more about Azure Load Balancer, continue to: |
| 295 | + |
| 296 | +> [!div class="nextstepaction"] |
| 297 | +> [What is Azure Load Balancer?](../load-balancer-overview.md) |
| 298 | +
|
0 commit comments