Free tech learning for everyone, from basics to pro

Azure SecurityCloud SecurityIntermediate

Azure network security: VNets, NSGs, Azure Firewall, private endpoints and Bastion

In short: Azure network security combines network security groups for basic filtering, Azure Firewall for central inspection in a hub, private endpoints to keep PaaS traffic off the internet, and Azure Bastion for admin access without public IPs. User-defined routes tie them together.

Starting point: the VNet

An Azure Virtual Network (VNet) is your private network in a region (the general ideas are in cloud networking basics). By default, resources in a VNet can talk to each other and reach the internet outbound. Security work is about narrowing those defaults and adding inspection where it matters.

Azure network security toolsHub VNetshared securityNSGssubnet and NIC rulesAzure Firewallcentral inspectionPrivate endpointsprivate PaaS accessBastionbrowser RDP/SSHDDoS Protectionvolumetric attacksApp Gateway WAFweb attacks
Figure 1. Azure network security services, often centralised in a hub virtual network.

Network security groups

A network security group (NSG) is a list of stateful allow and deny rules, checked in priority order (lowest number first). You can attach an NSG to a subnet, a network interface, or both. Each NSG includes default rules that allow VNet-to-VNet traffic and load balancer probes, and deny other inbound internet traffic.

  • Use service tags such as Internet, VirtualNetwork or Storage instead of long IP lists.
  • Use application security groups (ASGs) to group VMs by role, for example "allow 443 from asg-web to asg-app".
  • Turn on VNet flow logs (the successor to NSG flow logs) and analyse them in Log Analytics.
az network nsg rule create --resource-group rg-app --nsg-name nsg-app --name allow-web-to-app --priority 200 --direction Inbound --access Allow --protocol Tcp --source-asgs asg-web --destination-asgs asg-app --destination-port-ranges 8443

Azure Firewall and routing

Spoke traffic through the hubSpoke VM10.1.2.4UDR0.0.0.0/0 tofirewallAzureFirewallrules, threatintelDestinationinternet orspokeLogsLog Analytics
Figure 2. User-defined routes send spoke traffic through Azure Firewall so it can be filtered and logged.

Azure Firewall is a managed, stateful firewall service. It supports network rules, application rules based on fully qualified domain names (FQDNs), threat intelligence filtering and, in the Premium tier, TLS inspection and intrusion detection and prevention. It normally sits in a hub VNet. Spoke VNets peer with the hub, and user-defined routes (UDRs) send their traffic to the firewall's private IP.

ControlLayerBest for
NSG3-4Basic allow/deny on subnets and NICs
Azure Firewall3-7Central egress control, FQDN filtering, logging
Application Gateway or Front Door WAF7Protecting web apps from attacks like SQL injection
DDoS Protection3-4Absorbing volumetric attacks on public IPs

Private endpoints and Bastion

Platform services such as Storage, SQL Database and Key Vault have public endpoints by default. A private endpoint gives the service a private IP in your VNet using Azure Private Link. Pair it with a private DNS zone so the normal name resolves to the private IP, then disable public network access on the service.

Azure Bastion provides RDP and SSH to VMs through the Azure portal or native client over TLS, so VMs need no public IP and port 3389 or 22 never faces the internet. Combine it with just-in-time VM access in Defender for Cloud for extra control.

Tip: build and test NSG rules on your own subscription in the Azure VNet and NSG lab.

Practice

What is the difference between an NSG and Azure Firewall?
An NSG is a simple distributed packet filter per subnet or NIC; Azure Firewall is a central managed firewall with FQDN rules, threat intelligence and logging.
After adding a private endpoint for a storage account, apps still use the public IP. What is likely missing?
Private DNS: the storage name must resolve to the private endpoint IP, usually through a linked private DNS zone.
How does Azure Bastion improve security?
Admins reach VMs over TLS through Bastion, so VMs need no public IP and RDP/SSH ports are not exposed to the internet.

Key takeaways

  • NSGs are stateful, priority-ordered rules on subnets and NICs.
  • Azure Firewall in a hub, with UDRs, centralises inspection and logging.
  • Private endpoints plus private DNS keep PaaS traffic private.
  • Bastion removes the need for public IPs on VMs.
  • Add WAF and DDoS protection for public-facing apps.
Tracks your learning on this device only. See your progress on the learning paths.

About the author

Mohamed Fayas

Founder of FM TecHub. CCNA certified, with a BTEC HND in Network Engineering, and BEng (Hons) in Computer Networking and Cloud Security. He writes practical, plain-English guides on networking, security and cloud.

More about the author

Original content written by Mohamed Fayas for FM TecHub. © 2026 FM TecHub. You're welcome to share a link to this page; please don't copy the text elsewhere without permission.

Stay up to date by email

New notes, tools and security news from FM TecHub, explained simply. Free.

We only use your email to send these updates. See our privacy policy.