SC500-NSG-001SC-500Study guide skill: Implement and manage network security groups (NSGs) and application security groups (ASGs)Reviewed

Contoso runs the front-end, API, and database VMs of an ordering app in one virtual network and placed their NICs in the application security groups asg-front, asg-api, and asg-sql. NSG1, associated with the subnets, has no custom inbound rules yet. Which inbound rules should you add to NSG1 so that only asg-api can connect to TCP 1433 on asg-sql?

  1. A. Priority 110: asg-api → asg-sql, TCP 1433, Allow. Add only this ruleIncorrect
  2. B. Priority 110: asg-api → asg-sql, TCP 1433, Allow. Priority 120: Any → asg-sql, 1433, DenyCorrect
  3. C. Priority 110: Any → asg-sql, 1433, Deny. Priority 120: asg-api → asg-sql, TCP 1433, AllowIncorrect
  4. D. Priority 110: asg-api → asg-sql, TCP 1433, Allow. Priority 120: Internet → asg-sql, 1433, DenyIncorrect
Show answer and explanation

Answer: B

Explanation

Network security group rules are processed in priority order with lower numbers first, and processing stops once traffic matches a rule.[2] Because the AllowVNetInBound default security rule allows all communication between resources in the same virtual network, you need a deny rule for traffic from all resources.[1] When the allow rule has a lower number than the deny rule, asg-api traffic is allowed first and all other traffic is blocked.[1]

With only the allow rule, traffic from asg-front also matches AllowVNetInBound at priority 65000 and is allowed.[2] With the deny rule at 110, asg-api traffic also stops at the deny rule and never reaches the allow rule at 120.[2] Inbound traffic from the internet is already denied by the DenyAllInbound default security rule, so blocking traffic from the same virtual network requires a deny rule whose source is Any.[1]


Sources

  1. Application security groupsMicrosoft Learn · Location: Allow-HTTP-Inbound-Internet, Deny-Database-All, Allow-Database-BusinessLogic · Checked
  2. Azure network security groups overviewMicrosoft Learn · Location: Security rules, Default security rules · Checked