Azure load balancer - setting up load balancer and vm as backend pool
In this example, we are going to setup an Azure public load balancer and backed by Azure VM backend pool. To get started we will do the following
- Create virtual Network
Goto Virtual Network -> Create -> Then provide the following configuration
Resource group: mylbrg
Virtual network name: lbvnet
Security: Do not do anything here
IP Address:
Default: 10.0.0.0/24
BackendPoolSubnet: 10.0.2.0/24
Review and create.
- Create 1 VM with a public ip and setup IIS
Goto Virtual Machine -> Create
Resource group: mylbrg
Virtual machine name: VM`1
In Networking tab, ensure you create a new Public IP for your VM.
Subnet is: BackendPoolSubnet
Enable Inbound port for: http, https and RDP
Leave the rest as it is. Click on Review and Create.
Once your VM is up and running, goto cloud shell and run the following command to setup IIS
Set-AzVMExtension -ResourceGroupName mylbrg -ExtensionName IIS -VMName VM1 -Publisher Microsoft.Compute -ExtensionType CustomScriptExtension -TypeHandlerVersion 1.4 -SettingString '{"commandToExecute":"powershell Add-WindowsFeature Web-Server; powershell Add-Content -Path \"C:\\inetpub\\wwwroot\\Default.htm\" -Value $($env:computername)"}' -Location AustraliaEast
- Create Load Balancer and configure front end and backend
Let's create a public load balancer.
Goto Load balancer -> Create
Resource group: mylbrg
Name: publiclb
Sku: standard
Type: public
In the front end configuration
Name: myfrontend
IP version: IPv4
IPType: IP addresss
Public IP address: Choose create new and give it a name.
Gateway Load Balancer: None.
Add Backend Pool
Name: BackEndPool
Virtual Network: Choose lbvnet
Under IP Configuration click on Add, and select the VM1 that you have just created.
Inbound Rules
Under inbound rules, click on "Add a load balancing rules" and configure using the screenshot here.
Name: httprule
IP Version: IPv4
Protocol: TCP
Port: 80
Backend Port: 80
Click on Create Health probe
Name: BasicHealthProbe
Leave the rest as it is. Click on Review and create.
Testing the configurations
Goto your LB and find the public IP address
Fire up your browser and hit this end point.
You should be able to see
Comments