Objective:
Set up an Azure Load Balancer that:
✅ Distributes traffic between Windows & Linux VMs.
✅ Uses Inbound NAT Rules for SSH (Linux) & RDP (Windows).
✅ Configures Outbound Rules for internet access.
✅ Includes a Health Probe for monitoring.
✅ Deploys NGINX on Linux automatically via a custom script.
✅ Allows manual IIS installation on Windows via RDP.
📌 Project Steps
Step 1: Create a Resource Group
1. Go to Azure Portal → Search Resource Groups.
2. Click Create Resource Group.
3. Name it: <YOUR_RESOURCE_GROUP>.
4. Region: North Europe (or preferred region).
5. Click Review + Create → Create.
Step 2: Create Virtual Network & Subnet
1. Search Virtual Networks → Click Create.
2. Name: VNET-LB → Region: North Europe.
3. Subnet Name: Subnet-LB → CIDR: 10.0.0.0/24.
4. Click Review + Create → Create.
Step 3: Create Public IP for Load Balancer
1. Search Public IP Addresses → Click Create.
2. Name: PIP-LB → Type: Static.
3. SKU: Standard → Click Create.
Step 4: Create the Azure Load Balancer
1. Search Load Balancers → Click Create.
2. Name: LB-Win-Linux → Region: North Europe.
3. SKU: Standard → Type: Public.
4. Public IP: Select PIP-LB.
5. Click Review + Create → Create.
Step 5: Configure Backend Pool (Windows & Linux VMs)
1. In Load Balancer, go to Backend Pools → Click Add.
2. Name: BackendPool-VMs.
3. Select Virtual Network: VNET-LB.
4. Add two Virtual Machines:
• Windows VM: Name Win-VM (Create new if needed).
Custom script to install IIS
• Linux VM: Name Linux-VM (Create new if needed).
I have created a linux VM with custom script
Custom data:
#cloud-config
package_update: true
package_upgrade: true
packages:
- nginx
runcmd:
- sudo ufw allow 80/tcp
- sudo systemctl start nginx
- sudo systemctl enable nginx
write_files:
- path: /var/www/html/index.html
permissions: '0644'
owner: www-data:www-data
content: |
<html>
<head><title>Welcome to NGINX on Ubuntu!</title></head>
<body><h1>Success! NGINX is running on Ubuntu.</h1></body>
</html>
I have made necessary changes to run nginx reverse proxy and listen on port 80 in the ubuntu VM.
5. Click Add → Save.
Step 6: Configure Health Probe
1. In Load Balancer, go to Health Probes → Click Add.
2. Name: HealthProbe-HTTP.
3. Protocol: HTTP → Port: 80 → Path: /.
4. Click Add.
Step 7: Configure Load Balancer Rules
7.1 Create HTTP Rule
1. Go to Load Balancer → Load Balancer Rules → Click Add.
2. Name: HTTP-Rule.
3. Frontend IP: PIP-LB.
4. Backend Pool: BackendPool-VMs.
5. Protocol: TCP → Port: 80 → Backend Port: 80.
6. Associate with HealthProbe-HTTP.
7. Click Add.
From the public IP of the Load balancer you can see the Nginx server running which is pointed to the ubuntu linux machine.
Step 8: Configure Inbound NAT Rules
8.1 RDP for Windows VM
1. In Load Balancer, go to Inbound NAT Rules → Click Add.
2. Name: RDP-Windows.
3. Frontend IP: PIP-LB.
4. Protocol: TCP → Port: 5001 → Target Port: 3389.
5. Target: Win-VM.
6. Click Add.
8.2 SSH for Linux VM
1. In Inbound NAT Rules, click Add again.
2. Name: SSH-Linux.
3. Protocol: TCP → Port: 5002 → Target Port: 22.
4. Target: Linux-VM.
5. Click Add.
Step 9: Configure Outbound Rules
1. Go to Outbound Rules → Click Add.
2. Name: Outbound-LB.
3. Frontend IP: PIP-LB.
4. Backend Pool: BackendPool-VMs.
5. Protocol: Any.
6. Click Add.
Step 10: Deploy Applications on VMs
10.1 Install NGINX on Linux VM (via Custom Script)
1. In Linux VM, go to Extensions → Click Add.
2. Select Custom Script Extension.
3. Use this script:
#!/bin/bash
sudo apt update -y
sudo apt install nginx -y
sudo systemctl enable nginx
sudo systemctl start nginx
4. Click OK.
10.2 Install IIS on Windows VM (via RDP)
1. Connect via RDP to Windows VM using Port 5001.
2. Run PowerShell as Admin:
Install-WindowsFeature -name Web-Server -IncludeManagementTools
3. Open http://localhost to verify IIS is running.
🎯 Expected Outcome
✅ Load Balancer distributes traffic to both Windows & Linux VMs.
✅ Inbound NAT allows RDP (Windows) & SSH (Linux).
✅ Outbound Rules enable internet access.
✅ Health Probes monitor VM health.
✅ NGINX on Linux & IIS on Windows serve web pages.