Introduction
Network Security Group (NSG) rules control the flow of network traffic to and from resources in Azure. They help protect your applications by allowing or blocking specific inbound and outbound traffic based on rules.
When you want to allow web traffic (HTTP/HTTPS) to your virtual machine from the internet.
When you need to block all inbound traffic except from a trusted IP range.
When you want to restrict outbound traffic from your VM to only specific ports or addresses.
When you want to allow SSH access only from your office IP to your Linux VM.
When you want to prevent your VM from accessing the internet except for specific services.