In VNet-Fin, web servers run in Subnet-Front, and their network interfaces are members of the application security group ASG-WebTier. Database servers run in Subnet-Back, which is associated with NSG-Back. NSG-Back contains a custom inbound rule that denies traffic from any source at priority 4000. Each database server’s network interface is associated with NSG-DB, which contains only the default rules. The web servers must connect to the database servers on TCP port 1433, all other inbound traffic to the database servers must be blocked, and you must use the fewest security rules. What should you do?
Show answer and explanation
Correct answer: D · In NSG-Back, create an inbound rule that allows TCP 1433 from ASG-WebTier at priority 100
Inbound traffic is evaluated by the subnet NSG first and then by the NIC NSG, and both must allow it. In NSG-Back, an allow at priority 100 matches before the deny at 4000, because lower numbers are processed first. NSG-DB already permits the web servers through its default AllowVnetInBound rule, because both tiers are in VNet-Fin. Everything else is still stopped by the deny at 4000 in NSG-Back. Using the ASG as the source is valid because the web and database interfaces are in the same virtual network.
Why the other choices do not fit
- NSG-DB already allows this traffic through AllowVnetInBound. The block is the deny at 4000 in NSG-Back, which is evaluated first for inbound traffic and is not changed.
- Priority 4096 is valid for a custom rule, but it is processed after the deny at 4000. The deny still matches the traffic first.
- This works, but the NSG-DB rule is redundant because the default AllowVnetInBound rule already permits the traffic. Two rules fail the fewest-rules requirement.
