Network Security Group (NSG)

မင်္ဂလာပါ၊ Mindgnite.com ရဲ့ Cloud Knowledge Sharing မှ ပြန်လည်ကြိုဆိုပါတယ်။ ယခင် article မှာ Azure Virtual Network (VNet) အကြောင်းကို လေ့လာခဲ့ပြီးပါပြီ။ ဒီတခါတော့ VNet ထဲမှာရှိတဲ့ Resources တွေကို ပိုမိုလုံခြုံအောင် ဘယ်လိုလုပ်ဆောင်နိုင်မလဲဆိုတာကို Network Security Group (NSG) နဲ့ Application Security Group (ASG) တို့ကို အသုံးပြုပြီး ရှင်းပြပေးသွားမှာဖြစ်ပါတယ်။


Network Security Group (NSG) ဆိုတာဘာလဲ

Network Security Group (NSG) ဆိုတာကတော့ Azure VNet ထဲက Resources တွေဆီကို ဝင်လာတဲ့ (Inbound) နဲ့ ထွက်သွားတဲ့ (Outbound) Network Traffic တွေကို ထိန်းချုပ်ပေးတဲ့ Security Rule တွေကို စုစည်းထားတာဖြစ်ပါတယ်။ ၎င်းဟာ Network Traffic ကို ခွင့်ပြုမလား၊ ပိတ်ဆို့မလားဆိုတာကို ဆုံးဖြတ်ပေးနိုင်ပါတယ်။

  • NSG ကို ဘယ်မှာ အသုံးပြုနိုင်လဲ?
    • Subnet: NSG ကို Subnet တစ်ခုလုံးအပေါ် ချိတ်ဆက်ထားမယ်ဆိုရင် အဲ့ဒီ Subnet ထဲမှာရှိတဲ့ Resources အားလုံးကို အကျုံးဝင်ပါတယ်။
    • Network Interface Card (NIC): VM တစ်ခုချင်းစီရဲ့ NIC အပေါ်မှာလည်း NSG ကို ချိတ်ဆက်နိုင်ပါတယ်။

NSG Rules တွေရဲ့ အလုပ်လုပ်ပုံ

NSG တွေဟာ Priorities (ဥပမာ- 100, 200, 300) အပေါ် အခြေခံပြီး အလုပ်လုပ်ပါတယ်။ Rule တစ်ခုချင်းစီမှာ Source, Destination, Port နဲ့ Protocol တွေကို သတ်မှတ်ပြီး Allow (ခွင့်ပြု) ဒါမှမဟုတ် Deny (ပိတ်ဆို့) လုပ်နိုင်ပါတယ်။ Priority နံပါတ်နည်းလေလေ ပိုပြီး အရေးကြီးလေလေဖြစ်ပါတယ်။

Application Security Group (ASG) ဆိုတာဘာလဲ

Application Security Group (ASG) ဆိုတာကတော့ Security Rules တွေကို Application Workload အပေါ်မှာ အခြေခံပြီး စုစည်းနိုင်ဖို့ ကူညီပေးတဲ့ လုပ်ဆောင်ချက်တစ်ခုဖြစ်ပါတယ်။ ၎င်းဟာ VM တွေရဲ့ IP Address တွေကို လက်နဲ့လိုက်မှတ်နေစရာမလိုဘဲ အုပ်စုဖွဲ့ပေးနိုင်ပါတယ်။

  • ASG ရဲ့ အဓိကအကျိုးကျေးဇူးများ
    • Simplicity (လွယ်ကူခြင်း): NSG Rules တွေမှာ IP Address တွေအစား ASG နာမည်တွေကို အသုံးပြုနိုင်တဲ့အတွက် Management ကို ပိုမိုလွယ်ကူစေပါတယ်။
    • Flexibility (လိုက်လျောညီထွေမှု): သင့် Application ရဲ့ Architecture ပြောင်းလဲသွားရင်တောင် IP Address တွေကို လိုက်ပြောင်းစရာမလိုဘဲ ASG မှာပဲ VM တွေကို ထပ်ထည့်နိုင်ပါတယ်။

လက်တွေ့ဥပမာ

Scenario: သင်ဟာ Web Application တစ်ခုကို တည်ဆောက်ထားပါတယ်။ ၎င်းမှာ Web Server နဲ့ Database Server တွေရှိပါတယ်။

  • NSG: Web Server ရဲ့ Public IP ကို Port 80 (HTTP) နဲ့ 443 (HTTPS) ကနေ ဝင်လာတဲ့ Traffic တွေကို NSG Rule နဲ့ Allow လုပ်ထားနိုင်ပါတယ်။ ဒါ့အပြင် Database Server ကို Web Server မှသာ ချိတ်ဆက်နိုင်အောင် Rule သတ်မှတ်နိုင်ပါတယ်။
  • ASG: Web Server တွေအားလုံးကို WebServers-ASG လို့ အုပ်စုဖွဲ့ပြီး၊ Database Server တွေကို DatabaseServers-ASG လို့ အုပ်စုဖွဲ့နိုင်ပါတယ်။ ပြီးရင် NSG Rule မှာ Source ကို WebServers-ASG နဲ့ Destination ကို DatabaseServers-ASG လို့ သတ်မှတ်ပေးပြီး Port 1433 (SQL Server) ကို Allow လုပ်နိုင်ပါတယ်။ ဒီလိုလုပ်ခြင်းဖြင့် နောက်ထပ် Web Server အသစ်ထပ်ထည့်တဲ့အခါမှာ NSG Rule တွေကို ပြောင်းလဲစရာမလိုတော့ပါဘူး။

နောက် လာမယ့် Article မှာ တော့ Azure Firewall ဘယ်လို အလုပ်လုပ် သလဲ ဆိုတာကို ဆက်လက် လေ့လာသွားကြပါမယ်။

English Version

Welcome back to Cloud Knowledge Sharing Article from Mindgnite.com. In a previous article, we learned about Azure Virtual Networks (VNet). Today, we’ll learn how to secure resources within a VNet using Network Security Groups (NSG) and Application Security Groups (ASG).


What is a Network Security Group (NSG)?

A Network Security Group (NSG) is a collection of security rules that control inbound and outbound network traffic to Azure resources within a VNet. It decides whether to allow or deny network traffic.

  • Where can you use an NSG?
    • Subnet: When you associate an NSG with a subnet, the rules apply to all resources within that subnet.
    • Network Interface Card (NIC): You can also associate an NSG with an individual VM’s NIC.

How NSG Rules work

NSGs work based on Priorities (e.g., 100, 200, 300). Each rule specifies the Source, Destination, Port, and Protocol and can either Allow or Deny the traffic. A lower priority number means the rule is more important.


What is an Application Security Group (ASG)?

An Application Security Group (ASG) is a feature that helps you group security rules based on application workloads. It eliminates the need to manually manage VM IP addresses.

  • Key Benefits of ASGs
    • Simplicity: You can use ASG names in your NSG rules instead of IP addresses, which makes management much easier.
    • Flexibility: Even if your application’s architecture changes, you can simply add new VMs to the ASG without having to change your NSG rules.

Practical Example

Scenario: You have a web application with Web Servers and Database Servers.

  • NSG: You can create an NSG rule to allow inbound traffic to your Web Server’s Public IP on Port 80 (HTTP) and 443 (HTTPS). Additionally, you can set a rule to only allow the Database Server to be accessed by the Web Server.
  • ASG: You can group all Web Servers into an ASG called WebServers-ASG and all Database Servers into an ASG called DatabaseServers-ASG. Then, in your NSG rule, you can specify the Source as WebServers-ASG and the Destination as DatabaseServers-ASG and allow Port 1433 (SQL Server). This way, if you add new Web Servers later, you don’t need to change the NSG rules.

Scroll to Top
Share via
Copy link