Skip to main content

Building a Secure Three-Tier Network Architecture in Microsoft Azure: A Hands-On Guide

Learn how to design a secure Azure Virtual Network with segmented subnets, deploy Linux virtual machines, configure Network Security Groups (NSGs), implement User-Defined Routes (UDRs), and validate secure communication between application tiers.

Updated 3 min readMarkdown
Building a Secure Three-Tier Network Architecture in Microsoft Azure: A Hands-On Guide

In today's project we will be building a step by step multi-tier infrastructure using Azure.

Prerequisite

  1. Azure portal

  2. Git bash

  3. Browser

Step 1:

Create the Virtual Network

Sign in to the Azure Portal.

Search for Virtual Networks.

Click Create.

Basics Setting Value Resource Group Lab-RG Name Production-VNetRegion Choose your preferred region IP Addresses

Address Space:

10.0.0.0/16

Create the following subnets:

Subnet Address Range Frontend-subnet 10.0.1.0/24

Backend-subnet 10.0.2.0/24

Database-subnet 10.0.3.0/24

Created the VNet.

Step 2: Create NSGs

Create two NSGs:

Frontend-NSG

Search:

Network Security Groups

Create:

Frontend-NSG

Backend-NSG

Create:

Backend-NSG

Step 3: Configure Frontend NSG Rules

Attach Frontend-NSG to Frontend-subnet.

Add inbound rules:

Priority Source Port Protocol Action 100 Internet 80 TCP Allow

Allow 110 Internet 443 TCP Allow

120 Your IP 22 TCP Allow

4096 Any Any Any Deny

This allows:

HTTP HTTPS SSH from your workstation only

Step 4: Configure Backend NSG Rules

Attach Backend-NSG to Backend-subnet.

Create inbound rule:

Priority Source Source Address 100 IP Addresses 10.0.1.0/24

Destination:

Any

Protocol:

Any

Action:

Allow

Leave default DenyAllInbound rule.

Result:

✅ Frontend subnet can access Backend VM

✅ Internet cannot access Backend VM

Step 5: Deploy Frontend VM

Create a Linux VM.

Recommended:

Setting Value Name frontend-vm Image Ubuntu 24.04 LTS Size B1s Authentication SSH Key

Networking:

Setting Value Virtual Network Production-VNet Subnet Frontend-subnet Public IP Create New NSG Frontend-NSG

Create VM.

Step 6: Deploy Backend VM

Create another Linux VM.

Setting Value Name backend-vm Image Ubuntu 24.04 LTS Size B1s

Networking:

Setting Value VNet Production-VNet Subnet Backend-subnet Public IP None NSG Backend-NSG

Create VM.

Step 7: Verify Public Access Frontend VM

Obtain Public IP: ssh azureuser@

Should connect successfully.

Backend VM

Try: ssh azureuser@

from your laptop.

Expected: Connection timed out because:

No Public IP NSG blocks Internet traffic

Requirement satisfied.

Step 8: Test Frontend → Backend Connectivity

SSH into Frontend VM.

Find Backend private IP:

Example:

10.0.2.4

Install ping utility:

sudo apt update sudo apt install iputils-ping -y

Ping Backend:

ping 10.0.2.4

Expected:

64 bytes from 10.0.2.4

Requirement satisfied.

Step 9: Install a Web Server on Frontend sudo apt update sudo apt install nginx -y

Enable: sudo systemctl enable nginx sudo systemctl start nginx

Browse: http://

You should see the Nginx welcome page.

Requirement satisfied:

✅ Frontend VM reachable via Public IP.

Step 10: Create User Defined Route (UDR)

Search:

Route Tables

Create:

Frontend-Backend-RT Add Route Field Value Route Name InternalRoute Address Prefix 10.0.2.0/24 Next Hop Type Virtual Network

Associate Route Table with:

Frontend-subnet Result:

Traffic destined for Backend subnet remains inside Azure's virtual network routing and never traverses the Internet.

Validation Checklist Requirement Status Create VNet ✅ Frontend subnet ✅ Backend subnet ✅ Database subnet ✅ Linux VM in Frontend ✅ Linux VM in Backend ✅ HTTP/HTTPS allowed to Frontend ✅ Backend accepts traffic only from Frontend subnet ✅ Internet blocked from Backend ✅ Frontend has Public IP ✅ Backend has no Public IP ✅ Frontend can ping Backend ✅ UDR configured ✅

No comments yet. Be the first to comment.