As I progressed in my Azure journeyâfrom creating virtual machines to managing identitiesâI realized that networking is the glue that connects and secures all cloud resources. Without proper networking, even the best applications and services can fail to communicate or remain exposed to threats.
In this blog, Iâll share how Iâve worked with core Azure networking components like Virtual Networks (VNets), Network Security Groups (NSGs), and VNet Peeringâexplained in a simple, step-by-step style.
â What Youâll Learn:
- What is an Azure Virtual Network (VNet)?
- How Network Security Groups (NSGs) protect traffic
- How I use VNet Peering to connect networks
- Real-world setup examples
- Best practices I follow for secure Azure networking
đ¸ď¸ What is a Virtual Network (VNet)?
A Virtual Network (VNet) in Azure is like your private network in the cloud. It allows me to:
- Connect VMs, databases, and app services privately
- Define IP address ranges and subnets
- Connect to on-premises networks using VPNs or ExpressRoute
Example:
When I deployed a web app and a database in Azure, I placed them in the same VNet but different subnets:
Subnet-Web
for the front-end VMSubnet-DB
for the database VM
This let me isolate traffic and apply different security rules.
đ What is a Network Security Group (NSG)?
NSGs are like virtual firewalls that control inbound and outbound traffic at the subnet or NIC level. I use NSGs to:
- Allow only RDP or SSH from specific IPs
- Block all internet access to backend services
- Log dropped connections for auditing
Example:
For a production VM, I created an NSG with these rules:
Priority | Direction | Port | Source | Action |
---|---|---|---|---|
100 | Inbound | 22 | My Office IP | Allow |
200 | Inbound | * | Internet | Deny |
đ What is VNet Peering?
VNet Peering lets me connect two VNets privately so that resources in both networks can communicate securelyâwithout going over the public internet.
This is especially helpful when:
- I have separate VNets for Dev and Prod
- I want to isolate environments but still allow internal communication
How I Set Up Peering:
- Go to Virtual Network > Peerings
- Add a peering connection between
VNet-Dev
andVNet-Prod
- Enable âAllow traffic to remote virtual networkâ
After that, the VMs in each VNet could ping and communicate using private IPs.
đ§ Networking Tips I Follow
- Use NSGs on both subnets and NICs for layered security
- Keep production, staging, and dev in separate VNets or subnets
- Always block unused ports, especially 3389 (RDP) and 22 (SSH)
- Use VNet Peering instead of VPN when both VNets are in the same regionâitâs faster and cheaper
- Donât forget to enable NSG flow logs for monitoring and alerts
đ Real-World Scenario
In one of my Azure projects, I had to set up:
- A front-end app in
VNet-App
- A backend database in
VNet-DB
- An on-prem site-to-site VPN connected to
VNet-Core
I used VNet Peering to link all three, applied NSGs to restrict access, and ensured that only necessary ports were open. The performance improved, and security was much tighter.
đ Conclusion
Azure networking may seem complex at first, but once I understood VNets, NSGs, and Peering, it became a powerful tool to design secure, scalable, and high-performance architectures.
If youâre starting out, focus on setting up VNets with subnets, controlling access using NSGs, and connecting environments using Peering. These basics will set the stage for more advanced networking like VPNs, Azure Firewall, and Application Gateway.