Azure Network Security Groups (NSGs) Overview

Secure your Azure resources with powerful network traffic filtering.

Azure Network Security Groups (NSGs) are a fundamental component of network security in Microsoft Azure. They act as a virtual firewall for your network resources, allowing you to control inbound and outbound traffic at the network interface (NIC) or subnet level.

What are Network Security Groups?

An NSG contains a list of security rules that allow or deny network traffic to resources connected to an Azure Virtual Network (VNet). NSGs can be associated with one or more subnets, or with individual network interfaces (NICs) of virtual machines.

Key Components of an NSG:

How NSGs Work:

When traffic is sent to or from an Azure resource, the NSG associated with it is evaluated. Rules are processed in order of priority. The first rule that matches the traffic determines whether the traffic is allowed or denied.

Important Note: If no NSG is associated with a resource, all traffic is allowed by default. However, Azure's default security rules within an NSG allow all inbound and outbound traffic. You must explicitly configure rules to restrict traffic.

Default Security Rules:

Every NSG includes a set of default rules that cannot be deleted but can be overridden by rules with higher priority (lower number):

Associating NSGs:

If both a subnet and a NIC have NSGs associated, both NSGs are evaluated. The order of evaluation is NIC NSG first, then subnet NSG.

Benefits of Using NSGs:

Use Cases:

Understanding and effectively configuring Network Security Groups is crucial for building secure and robust applications on Azure. Refer to the following resources for more detailed information and configuration guides.