Labor Day starts with $70+ in savings on Coursera Plus. Save 40% for 3 months.
Explore the role of a network security group (NSG) and understand how it safeguards cloud networks. Learn about the features, use cases, and best practices of network security groups. Discover ways to strengthen your skills and protect your digital assets.
![[Featured Image] A tech professional working on network security, representing the implementation of NSG rules to control traffic flow and protect cloud resources.](https://d3njjcbhbojbot.cloudfront.net/api/utilities/v1/imageproxy/https://images.ctfassets.net/wp1lcwdav1p1/3l3ItxWHGG59B595s8ZbQ2/2dfc0a799752d6bbc67cebf8b377d6ee/GettyImages-1451456915-converted-from-jpg.webp?w=1500&h=680&q=60&fit=fill&f=faces&fm=jpg&fl=progressive&auto=format%2Ccompress&dpr=1&w=1000)
A network security group refers to a set of rules that controls incoming and outgoing traffic within a cloud environment.
A network security group in Microsoft Azure enables you to customize rules for the flow of traffic between Azure virtual networks.
A network security group is essential in providing rule-based access control that specifies the direction, source, protocol, action, and range of network traffic.
To create a network security group in Azure, access your Microsoft Azure Portal, where you can define your security rules based on the needs of your organization. Learn more about network security groups and how they can help keep your cloud infrastructure secure.
If you’re ready to begin building relevant skills, consider enrolling in the Information Technology (IT) and Cloud Fundamentals Specialization from IBM. This beginner-level program offers the opportunity to develop skills in cloud development, cloud computing architecture, database administration, computer programming, and more.
A network security group, or NSG, is a set of rules that controls incoming and outgoing traffic to and from a virtual network interface, subnet, or other network resource within a cloud environment. These rules are usually based around parameters like source and destination IP addresses, ports, and protocols.
NSGs play an essential role in cloud environments by regulating traffic and increasing security. They block unauthorized access and facilitate legitimate connections based on your rules. In effect, NSGs prevent a potential cybersecurity threat while restricting traffic at various network levels. For example, in Microsoft Azure, you can assign NSGs to subnets and individual virtual machines (VMs) within them to enforce security policies specific to each resource.
It’s important to note that an NSG can only operate on Open Systems Interconnection (OSI) layer three, the network layer, and layer four, the transport layer. This differs from a firewall, which operates on layers three, four, and seven, the application layer. Because of the additional layer a firewall offers, some organizations opt for an NSG and a firewall.
Read more: Types of Firewalls for Cybersecurity
NSGs offer three significant advantages for your virtual network: the ability to define the security rules for network traffic, provide additional security at the network layer, and log the IP traffic passing through your NSG. Take a closer look at each of these key features:
NSGs operate using a series of rules that define whether to allow or deny specific traffic. Rules are processed in order of priority, starting from the lowest numbered rule. Rules can specify:
Direction: Whether inbound or outbound, traffic should follow the rule
Source and destination: Which IP ranges or addresses to permit
Protocol: Whether the rule applies to TCP, UDP, ICMP, ESP, AH, or Any
Port range: Which ports the rule affects (such as port 80 or port 10000-10005)
Action: Whether something can or cannot occur
NSGs complement your firewall to provide additional security at the network layer. Specifically, they control traffic based on the rules set by your administrator and manage data packets based on IP and port information. This approach helps ensure the virtual network has proper protection, contributing to a more secure cloud environment.
Logging and monitoring are essential for maintaining the security of your infrastructure and responding to threats. Features like flow logs in Microsoft Azure NSGs allow administrators to analyze traffic patterns for suspicious activity, identify anomalies, and fine-tune the rules.
Further integration with tools like Azure Monitor or AWS CloudWatch only improves the NSG's logging and monitoring capabilities.
A network security group in Azure gives you the ability to manage inbound and outbound traffic between Azure virtual networks, based on default network security rules in every NSG. You can customize these rules for specific destinations and sources to help keep your cloud infrastructure secure.
From multi-cloud to hybrid-cloud setups, NSGs can be a helpful tool for many organizations hoping to add an extra layer of protection. Some professionals who can benefit from NSGs include:
NSGs help cloud administrators manage cloud environments' traffic patterns and security issues. This supervision is vital for ensuring that only authorized traffic reaches your organization’s critical resources.
For network engineers, NSGs simplify traffic management by offering you centralized control over access rules and configurations.
Security teams rely on NSGs to enforce compliance with organizational policies, secure virtual machines, and isolate development environments.
When setting up an NSG, you want to adhere to certain best practices in order to make it as effective as possible. While configuring your NSG, keep in mind:
Implementing the principle of least privilege (PoLP) ensures that only the necessary systems and users receive access. For example, when dealing with a third-party contractor, you want to limit the time and scope of their access to your system or limit outbound traffic to trusted domains.
Conduct periodic reviews of your NSG configurations to identify outdated or overly permissive rules. Update these rules to reflect changes in infrastructure or policy.
Tags and application security groups (ASGs) simplify rule management by grouping resources with similar security requirements. For example, you can assign rules that permit inbound traffic from certain IP addresses to a particular group of web servers.
To set up your first NSG, head to the Microsoft Azure portal and log in to (or create) your Azure account. (This process will be different for PowerShell or Azure CLI users.) Next, select “Network security groups” and click “Create.”
From there, define your inbound and outbound security rules based on your organizational requirements. Then, assign the NSG to a subnet or network interface to associate it with the necessary resources.
Testing helps make sure your NSG rules work as intended. Some methods include:
Network traffic simulations: Use tools like Wireshark to analyze packet flow and simulate network traffic.
Penetration testing: Verify the robustness of your rules against potential attacks by running penetration testing.
To deepen your understanding of NSGs, consider consulting the detailed guides and tutorials offered by platforms like Microsoft Azure. You can also join discussions on community forums through Stack Overflow or the Microsoft Tech Community. Boot camps that cover network cybersecurity are also available. Platforms like YouTube also provide step-by-step video walkthroughs.
Subscribe to our weekly LinkedIn newsletter, Career Chat, for updates on popular skills, tools, and certifications. Then, check out some of our other free resources to keep learning more about network security:
Watch on YouTube: A Beginner’s Guide to Cloud Security
Plan your learning journey: Cloud Computing Learning Roadmap: From Beginner to Expert
Whether you want to develop a new skill, get comfortable with an in-demand technology, or advance your abilities, keep growing with a Coursera Plus subscription. You’ll get access to over 10,000 flexible courses.


Editorial Team
Coursera’s editorial team is comprised of highly experienced professional editors, writers, and fact...
This content has been made available for informational purposes only. Learners are advised to conduct additional research to ensure that courses and other credentials pursued meet their personal, professional, and financial goals.