Study guide
7.1 Network Security Groups and Application Security Groups
Microsoft Certified: Cloud and AI Security Engineer Associate SC-500
Track your progress as you read
Finished sections get a check mark.
1 Introduction & Exam Overview
1.1 Current Exam Facts 1.2 Skills Measured & Weightings 1.3 Study Path, Prerequisites & Exam Strategy
2 Microsoft Entra ID Secure Access
2.1 Privileged Identity Management (PIM) 2.2 Conditional Access Policies 2.3 MFA and Passwordless Authentication 2.4 Application Identities, OAuth Consent & Managed Identities
3 Azure Key Vault Secrets and Keys
3.1 Deploy and Configure Key Vault 3.2 Access Control and Firewall for Key Vault 3.3 Keys, Secrets, Certificates & Defender for Key Vault
4 Governance, Policy & RBAC
4.1 Azure Policy for Security Controls 4.2 Defender for Cloud Compliance & Security Standards 4.3 Resource Locks and Azure RBAC 4.4 Custom Roles, Overprivileged Access, Backup & IaC Security
5 Secure Storage Accounts
5.1 Storage Account Security Fundamentals 5.2 Storage Firewalls and Access Policies 5.3 Defender for Storage
6 Secure Databases
6.1 Azure SQL Platform Security 6.2 Database Auditing 6.3 Defender for Databases
7 Network Security Groups & Virtual Network Manager
7.1 Network Security Groups and Application Security Groups 7.2 Azure Virtual Network Manager Security Admin Rules 7.3 Virtual WAN and VPN Security
8 Private Access, Private Link & Azure Firewall
8.1 Microsoft Entra Private Access 8.2 Private Endpoints and Private Link 8.3 Azure Firewall 8.4 Network Watcher Diagnostics and Effective Rules
9 Security for AI Workloads
9.1 Purview DSPM for AI and Data Overexposure 9.2 Copilot Studio Protection and Agent Management 9.3 Microsoft Entra Agent ID Security 9.4 Defender for AI, Foundry Guardrails & AI Gateway
10 Secure Servers and Virtual Machines
10.1 Disk Encryption 10.2 Azure Bastion and JIT VM Access 10.3 Azure Arc and Defender for Servers 10.4 Trusted Launch, VM Security Features & Machine Configuration
11 Application Platform Security
11.1 Containers: AKS, ACR, ACI, Container Apps & Defender for Containers 11.2 Azure Functions and Logic Apps Security 11.3 Azure App Service Security 11.4 Web Application Firewall and API Management Protection
12 Defender for Cloud Security Posture
12.1 Defender CSPM and Secure Score 12.2 Workload Protection Plans and Multicloud Connectors 12.3 Vulnerability Management and Defender EASM
13 Microsoft Sentinel Activity and Event Collection
13.1 Workspaces, Roles & Content Hub 13.2 Data Connectors, Syslog/CEF & Windows Event Collection 13.3 Custom Tables, Retention & Purview Audit 13.4 Automation Rules and Playbooks
14 Microsoft Security Copilot & Final Review
14.1 Microsoft Security Copilot Workspaces and Roles 14.2 Plugins and Security Agents 14.3 Final Review and Exam-Day Strategy
7.1 Network Security Groups and Application Security Groups
Key Takeaways Explain This Topic AI
NSG rules evaluate by priority (lower number first) on a five-tuple of source, source port, destination, destination port, and protocol, then stop at the first match.
Default rules allow VNet-to-VNet and outbound Internet while DenyAllInbound blocks unsolicited public access; override with higher-priority custom rules—you cannot delete defaults.
Associate NSGs to subnets for shared policy and/or NICs for host-level tightening; both associations apply, so effective rules must be evaluated together.
Application Security Groups let you name groups of NICs (for example Web, App, DB) and write NSG rules against those groups instead of brittle IP lists.
Use Azure Network Watcher effective security rules to see the merged inbound/outbound policy on a NIC, including Virtual Network Manager admin rules when present.
Last updated: July 2026
Why NSGs and ASGs Matter on SC-500
Under Secure storage, databases, and networking , the SC-500 blueprint explicitly measures implement and manage network security groups (NSGs) and application security groups (ASGs) and evaluate effective security rules by using Azure Network Watcher diagnostics . This section is the foundation for every later network control: Virtual Network Manager security admin rules sit above NSGs, Azure Firewall inspects at different layers, and private endpoints still depend on correct NSG intent when policies are enabled.
NSGs filter IPv4/IPv6 traffic between Azure resources in virtual networks using allow/deny rules at Layer 3 and Layer 4. They do not terminate TLS, inspect HTTP bodies, or replace identity controls—think of them as programmable firewall ACLs attached to subnets and network interfaces.
Anatomy of an NSG Rule
Each custom security rule has the properties exam stems love to mix:
- Property What to know for SC-500
- Name Unique within the NSG; up to 80 characters
- Priority Integer 100–4096 ; lower number = higher priority ; first match wins
- Source / Destination Any, single IP, CIDR, service tag , or application security group
- Source / Destination ports Single port, range (10000–10005), or comma-separated mixes (augmented rules)
- Protocol TCP, UDP, ICMP, ESP, AH, or Any
- Direction Inbound or outbound
- Action Allow or Deny
Rules are matched on the five-tuple : source address, source port, destination address, destination port, protocol. You cannot place two rules with the same priority and direction .
Stateful behavior: NSGs are stateful . If you allow outbound TCP 443, return traffic for that established flow is permitted without a matching inbound allow. You only need an inbound allow when the client initiates from outside . Conversely, allowing inbound 443 does not require a separate outbound rule for responses.
Flow records and rule changes: Existing connections keep flowing based on the connection state even if you later remove the allow rule. New connections see the updated policy. Exam scenario: closing an SSH allow mid-session leaves the active SSH session up until disconnect; a new SSH attempt is blocked.
Augmented security rules let one rule list multiple IPs/CIDRs and multiple ports—prefer them with service tags and ASGs so you do not maintain long IP lists.
Default Security Rules (Memorize the Intent)
Azure injects default rules into every NSG. You cannot delete them; you override with lower-number custom rules.
Inbound defaults
- Priority Name Intent
- 65000 AllowVNetInBound Allow all traffic with VirtualNetwork service tag source and destination
- 65001 AllowAzureLoadBalancerInBound Allow health probes and LB traffic from AzureLoadBalancer
- 65500 DenyAllInbound Deny everything else (including Internet-initiated traffic)
- Outbound defaults
- Priority Name Intent
- 65000 AllowVNetOutBound Allow all VNet-to-VNet style traffic
- 65001 AllowInternetOutBound Allow outbound to Internet service tag
- 65500 DenyAllOutBound Deny residual outbound that did not match earlier allows
Exam trap: Because AllowVNetInBound permits free east-west traffic inside the VirtualNetwork tag, micro-segmentation requires explicit Deny (and selective Allow) custom rules . Leaving only defaults means any NIC in the VNet (subject to other NSGs) can talk to any other on any port—unsafe for production tiering.
Service tags (VirtualNetwork, Internet, Storage, Sql, AzureLoadBalancer, and many more) abstract Microsoft-managed prefix lists so rules stay correct as Azure IP ranges change.
Subnet Association vs NIC Association
You can associate an NSG with:
- Association Typical use Effect
- Subnet Shared baseline for all NICs in the subnet Every NIC in the subnet is subject to the subnet NSG
- NIC Per-workload tightening (jump box exception, single hardened VM) Applies only to that interface
Both apply when present. Traffic is evaluated against the effective combination of subnet NSG and NIC NSG. The practical model:
Inbound: traffic must be allowed by the subnet NSG and the NIC NSG (when both exist).
Outbound: same dual-check pattern for leaving the NIC and the subnet.
Design pattern: Put broad, shared rules (deny RDP/SSH from Internet, allow HTTPS from load balancer) on the subnet NSG . Put exceptions or extra hardening on the NIC NSG only when needed. Prefer subnet-level policy for scale; overuse of unique NIC NSGs becomes unmanageable.
Scenario: A web subnet NSG allows 443 from Internet. One VM also has a NIC NSG that denies 443. That VM will not serve public HTTPS even though neighbors will—the NIC deny wins for that interface.
Application Security Groups (ASGs)
ASGs group NICs by role so security policy follows application structure instead of IP addresses.
Classic three-tier example (Microsoft’s reference pattern):
- ASG Members Example policy
- AsgWeb Front-end NICs Allow Internet → TCP 80/443 to AsgWeb
- AsgLogic Middle-tier NICs Allow AsgWeb → app ports to AsgLogic
- AsgDb Database NICs Allow AsgLogic → TCP 1433 to AsgDb; deny all other to AsgDb
Because AllowVNetInBound is wide open, you typically add:
High-priority Allow from AsgLogic to AsgDb on 1433.
Slightly lower-priority Deny of any source to AsgDb on 1433 (or broader deny).
Only NICs that are members of the ASG named in a rule are affected by that rule. An NSG associated to a subnet still only applies ASG-based rules to matching members.
ASG constraints (exam-critical)
All NICs in one ASG must be in the same virtual network .
If a rule uses ASG as both source and destination, both ASGs’ NICs must live in that same VNet .
A NIC can belong to multiple ASGs (within subscription limits).
Prefer ASGs + service tags over IP churn when VMs scale in/out.
Micro-segmentation pattern: Combine subnet NSG baselines + ASG-based east-west allows + explicit denies for sensitive tiers. Pair with Just-in-Time VM access and Azure Bastion (compute chapter) so you never leave 3389/22 open to Internet.
Effective Security Rules and Network Watcher
When subnet NSG, NIC NSG, and (later) Virtual Network Manager security admin rules all exist, humans cannot reliably “eyeball” the result. Azure Network Watcher → Effective security rules shows the aggregated inbound and outbound rules applied to a specific NIC, including admin rules from Azure Virtual Network Manager.
Use effective rules for:
- Troubleshooting “why is this port blocked?”
- Auditing against a prescribed security baseline
- Confirming ASG membership actually expanded to the expected prefixes
SC-500 may phrase this as evaluate effective security rules using Network Watcher diagnostics —do not answer “read only the subnet NSG blade” when both NIC association and admin rules may apply.
Platform Footnotes That Bite in Exams
Host node services (DHCP, DNS, IMDS via 168.63.129.16 / related platform paths) are generally not blocked by ordinary NSG mistakes unless you explicitly target platform service tags such as AzurePlatformDNS or AzurePlatformIMDS.
Load-balanced VMs: source addresses in NSG evaluation are the original client, not the load balancer front end (except health probes, which use AzureLoadBalancer).
Stateful flows mean “deny later” is not a kill switch for already established sessions—plan operational break-glass accordingly.
Worked Scenario: Segment a Payment App
Requirements: Internet users hit web VMs on 443 only; app tier accepts only web tier on 8080; SQL accepts only app tier on 1433; no direct Internet RDP/SSH.
Correct approach:
Subnet-per-tier (Web, App, Data) with a shared NSG pattern or one NSG per subnet.
Create ASGs AsgWeb, AsgApp, AsgDb; assign NICs.
Custom inbound rules (priorities 100–200 range): allow Internet→AsgWeb:443; allow AsgWeb→AsgApp:8080; allow AsgApp→AsgDb:1433.
Deny rules after allows to block residual tier jumps (for example deny *→AsgDb:1433 with lower priority than the app allow).
Never open 22/3389 from Internet; use Bastion/JIT.
Validate with Network Watcher effective security rules on a sample NIC from each tier.
SC-500 Exam Traps (NSG/ASG)
Lower priority number wins —priority 100 beats 200.
Defaults allow full VNet communication ; segmentation is not free.
NSG is not a WAF and does not replace Azure Firewall application rules.
ASGs are not cross-VNet identity groups.
Effective rules > reading a single NSG when dual association or admin rules exist.
Stateful: do not invent reverse rules for return traffic on allowed flows.