DEV Community

Cover image for How to Create And Configure Network Security Groups
Maxwell Wokocha C.
Maxwell Wokocha C.

Posted on

How to Create And Configure Network Security Groups

What is a Network Security Group?

A Network Security Group (NSG) is a set of security rules that allow or deny network traffic to resources such as:

. Virtual Machines

. Subnets

. Network interfaces

Scenario:

Your organization requires the network traffic in the app-vnet to be tightly controlled. You identify these requirements.

. The frontend subnet has web servers that can be accessed from the internet. An application security group (ASG) is required for those servers. The ASG should be associated with any virtual machine interface that is part of the group. This will allow the web servers to be easily managed.

. The backend subnet has database servers used by the frontend web servers. A network security group (NSG) is required to control this traffic. The NSG should be associated with any virtual machine interface that will be accessed by the web servers.

. For testing, a virtual machine should be installed in the frontend subnet (VM1) and the backend subnet (VM2). The IT group has provided an Azure resource manager template to deploy these Ubuntu servers.

Architecture Diagram:

Skilling tasks:

. Create a network security group.

. Create network security group rules.

. Associate a network security group to a subnet.

. Create and use application security groups in network security group rules.

Note: The NSG requires resources to function so in this article we are going to provision a Windows and a Linux Virtual Machine.

  1. In the portal search for and select virtual machines. Verify both vm1 and vm2 are Running.

Create Application Security Group

Application security groups (ASGs) let you group together servers with similar functions. For example, all the web servers hosting your application.

  1. In the portal, search for and select Application security groups.

  2. Select + Create and configure the application security group.

  3. Select Review + create and then select Create.

Associate the application security group to the network interface of the VM.

  1. In the Azure portal, search for and select VM1.

  2. In the Networking blade, select Application security groups and then select Add application security groups.

  3. Select the app-frontend-asg and then select Add.

Create and Associate the Network Security Group.

  1. In the portal search for and select Network security group.

  2. Select + Create and configure the network security group.

  3. Select Review + create and then select Create.

Create Network Security Group rules

An NSG use security rules to filter inbound and outbound network traffic.

  1. In the search box at the top of the portal, enter Network security groups. Select Network security groups in the search results.

  2. Select app-vnet-nsg from the list of network security groups.

  3. In the Settings blade, select Inbound security rules.

  4. Select + Add and configure an inbound security rule.

Note: The lesser/lower the Priority Number given to the Rule, the Higher the Priority placed on the Rule.

Thank you, see you in the next post.

Top comments (0)