Dev.to Security 🔐 Cybersecurity 👁 0 📖 2 min read

Building an Azure Network Security Lab with NSGs and Network Watcher

Project 5/90 — My Cloud Engineering Journey As part of my 90-project Cloud Engineering challenge, I completed a hands-on project focused on Azure Network Security and Traffic Control. The goal was to deploy a Linux vir

Building an Azure Network Security Lab with NSGs and Network Watcher





 Project 5/90 — My Cloud Engineering Journey

As part of my 90-project Cloud Engineering challenge, I completed a hands-on project focused on Azure Network Security and Traffic Control.

The goal was to deploy a Linux virtual machine, configure network security rules, control inbound traffic, and verify those rules using Azure Network Watcher.

1. Creating the Azure Virtual Network

I started by creating an Azure Virtual Network (VNet) named nsg-vnet.

I configured the following address spaces:

  • VNet address space: 10.0.0.0/16
  • Subnet name: web-subnet
  • Subnet address range: 10.0.0.0/24

The subnet provides an isolated network segment for the virtual machine.

Azure Virtual Network address space

2. Configuring the Network Security Group

Next, I created a Network Security Group named nsg-web-security.

An NSG acts as a network traffic filter. It contains security rules that determine whether inbound or outbound traffic should be allowed or denied.

Network Security Group overview

Inbound Security Rules

I configured the following inbound rules:

Rule Port Protocol Action Source
Allow-HTTP 80 TCP Allow Any
Allow-HTTPS 443 TCP Allow Any
Allow-SSH-MyIP 22 TCP Allow My public IP
Deny-Port-8080 8080 TCP Deny Any

The SSH rule restricts remote administration to my own public IP address instead of exposing SSH access to everyone.

Port 8080 was intentionally blocked to test custom traffic filtering.

Configured inbound NSG rules

3. Associating the NSG with the Subnet

I associated the Network Security Group with web-subnet.

This allows the security rules to apply to network traffic entering or leaving resources connected to that subnet.

4. Deploying an Ubuntu Linux Virtual Machine

After configuring the network, I deployed an Ubuntu Linux virtual machine.

I connected to it through SSH using the permitted public IP address.

Once connected, I updated the package lists and installed Nginx.

sudo apt update
sudo apt install nginx -y

I verified that the Nginx service was running:

sudo systemctl status nginx

Nginx welcome page running on Azure VM

5. Testing Network Security Rules

Configuring security rules is not enough. I also wanted to verify that they behaved as expected.

For this, I used Azure Network Watcher IP Flow Verify.

Testing Port 8080

I tested traffic on TCP port 8080.

Network Watcher confirmed that the connection was denied by the custom NSG rule.

Network Watcher confirming port 8080 is denied

Testing HTTP Traffic

I tested TCP port 80 to verify that HTTP traffic was allowed.

Network Watcher confirming port 80 is allowed

Testing SSH Access

I also tested SSH access from my own public IP.

The connection was allowed, confirming that the SSH restriction was working as intended.

Network Watcher confirming SSH is allowed

6. What I Learned

This project helped me understand several important Azure networking concepts:

  • Virtual Networks and subnet architecture.
  • Network Security Groups and security rule priorities.
  • Inbound traffic filtering.
  • Restricting SSH access using source IP addresses.
  • Associating NSGs with subnets.
  • Deploying and managing an Ubuntu Linux VM.
  • Using Azure Network Watcher for traffic verification.

One important takeaway was understanding the difference between configuring a security rule and validating its actual behavior.

Note: Port 443 was allowed at the NSG level, but I did not configure an SSL certificate or HTTPS service on Nginx. Allowing a port through an NSG does not automatically configure HTTPS.

Conclusion

Project 5 gave me practical experience with Azure network security, Linux administration, and traffic filtering.

I'm continuing this challenge to develop my Cloud Engineering skills through practical projects rather than theory alone.

5/90 projects completed. 85 to go!

Feedback and suggestions are welcome.

Azure #CloudEngineering #AzureNetworking #NetworkSecurity #DevOps #Linux #LearningInPublic

📰 Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.