How Application Security Group Membership Affects NSG Rule Matching
Exhibit
NSG rule on ApiSubnet: Priority 200 Allow-WebToApi Source: ASG-Web Destination: ASG-Api Protocol: TCP Port: 8443 Priority 300 Deny-All-Other Source: Any Destination: Any Protocol: Any Port: * VM inventory: web01 NIC: Member of ASG-Web api01 NIC: Not a member of ASG-Api Symptom: TCP 8443 connections from web01 to api01 are denied.
Based on the exhibit, web servers can reach a backend VM only after it is added to a specific group. What should the administrator change to allow the traffic to match the existing NSG rule?
Quick Answer
The answer is to add api01’s NIC to ASG-Api. This is correct because an Application Security Group membership directly defines which network interfaces are included as a source or destination in an NSG rule; the exhibit shows the rule permits traffic from ASG-Web to ASG-Api, so even though web01 belongs to ASG-Web, the destination api01 will only match the rule if its NIC is a member of ASG-Api. On the AZ-104 exam, this tests your understanding that ASGs abstract IP addresses into logical groups, and a common trap is assuming any VM in the same subnet is automatically covered—membership must be explicitly assigned to the NIC. Remember the memory tip: “ASG membership is NIC-deep, not subnet-wide.”
⚠ Common exam trap
Many candidates think subnet placement or rule priority is the issue, but the core concept is that ASG membership must match the rule's destination to allow traffic.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Add api01's NIC to ASG-Api.
The exhibit shows that the NSG rule allows traffic from ASG-Web to ASG-Api. Since web01 is in ASG-Web, traffic from web01 to api01 is only permitted if api01 is a member of ASG-Api. Adding api01's NIC to ASG-Api ensures the destination matches the NSG rule, allowing the traffic.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
Add api01's NIC to ASG-Api.
Why this is correct
The NSG rule is already written to permit traffic from ASG-Web to ASG-Api on TCP 8443. The backend NIC is not in the destination ASG, so the allow rule never matches. Adding api01 to ASG-Api makes the existing rule effective without broadening access to the entire subnet.
- ✗
Move the deny rule to priority 100.
Why it's wrong here
Moving the deny rule earlier would make the problem worse. The allow rule must match before the deny rule, and in this case the destination ASG membership is the missing piece.
When this WOULD be correct
If the question asked to block all traffic from the web servers to the backend VM, moving a deny rule to priority 100 would ensure it is evaluated first and blocks the traffic.
- ✗
Change the source of the allow rule from ASG-Web to VirtualNetwork.
Why it's wrong here
Using VirtualNetwork would widen access beyond the intended app tier and would not preserve the current least-privilege design. The problem is not the source scope; it is the destination ASG membership.
When this WOULD be correct
This option would be correct if the requirement was to allow traffic from all resources within the virtual network (e.g., for internal management or monitoring) instead of restricting to a specific application group like web servers.
- ✗
Place api01 in the same subnet as web01.
Why it's wrong here
Subnet placement is not required for ASG-based NSG filtering. The existing rule can work across subnets as long as both NICs are in the correct ASGs.
When this WOULD be correct
This option would be correct if the question described a scenario where the NSG rule allows traffic from a specific subnet (e.g., subnet A) and the backend VM is in a different subnet. Moving the backend VM to the same subnet as the web servers would make it reachable without additional NSG rule changes.
Option-by-option analysis
Why each answer is right or wrong
Understanding why wrong answers are wrong — and when they would be correct — is what separates a 750 score from a 900. The AZ-104 exam frequently reuses these exact scenarios with slightly different constraints.
✓Add api01's NIC to ASG-Api.Correct answer▾
Why this is correct
The NSG rule is already written to permit traffic from ASG-Web to ASG-Api on TCP 8443. The backend NIC is not in the destination ASG, so the allow rule never matches. Adding api01 to ASG-Api makes the existing rule effective without broadening access to the entire subnet.
✗Move the deny rule to priority 100.Wrong answer — click to see why▾
Why this is wrong here
The deny rule at priority 100 would block all traffic before the allow rule is evaluated, preventing the intended traffic from reaching the backend VM. The question requires allowing traffic, not blocking it.
★ When this WOULD be the correct answer
If the question asked to block all traffic from the web servers to the backend VM, moving a deny rule to priority 100 would ensure it is evaluated first and blocks the traffic.
Why candidates choose this
Candidates may think that increasing the priority of a deny rule ensures it is evaluated before allow rules, but they overlook that the goal is to allow traffic, not deny it.
✗Change the source of the allow rule from ASG-Web to VirtualNetwork.Wrong answer — click to see why▾
Why this is wrong here
Changing the source from ASG-Web to VirtualNetwork would allow traffic from any virtual network resource, not just web servers, which violates the requirement that only web servers should reach the backend VM.
★ When this WOULD be the correct answer
This option would be correct if the requirement was to allow traffic from all resources within the virtual network (e.g., for internal management or monitoring) instead of restricting to a specific application group like web servers.
Why candidates choose this
Candidates may think that using 'VirtualNetwork' as source is a broader and simpler approach, overlooking the specific need to limit access to only web servers as per the question's constraint.
✗Place api01 in the same subnet as web01.Wrong answer — click to see why▾
Why this is wrong here
Placing api01 in the same subnet as web01 would change its IP address and potentially break existing configurations, but the question states that web servers can reach the backend VM only after it is added to a specific group. The issue is about NSG rule matching based on application security groups, not subnet placement.
★ When this WOULD be the correct answer
This option would be correct if the question described a scenario where the NSG rule allows traffic from a specific subnet (e.g., subnet A) and the backend VM is in a different subnet. Moving the backend VM to the same subnet as the web servers would make it reachable without additional NSG rule changes.
Why candidates choose this
Candidates may think that placing VMs in the same subnet automatically allows traffic between them, overlooking that NSGs can still block traffic within the same subnet. They might also confuse subnet-level NSG association with application security group membership.
Analysis generated from the official AZ-104blueprint and verified against question context. The “when correct” sections are what AI assistants cite when candidates ask “what’s the difference between these options?”
Go deeper
Related to this question
Learn chapter
Azure Arc for Servers
Key term
Group
A group is a collection of users, devices, or other objects that are assigned permissions and policies together for simplified management in identity and governance systems like Microsoft Entra ID.
Key term
ASG
An Availability Set is a logical grouping of virtual machines in Azure that helps ensure high availability by distributing VMs across different physical hardware within a datacenter.
About these practice questions
Courseiva writes every AZ-104 question from scratch — 1,049 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
Same concept, more angles
2 more ways this is tested on AZ-104
These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.
Variation 1. A web tier and an app tier run on separate Azure VMs in the same region. Each VM's NIC is added to an application security group named WebASG or AppASG. The administrator must allow only the web tier to connect to the app tier on TCP 8443, and future VM scale-outs must be included automatically. Which NSG rule should be created?
medium- A.An inbound rule that uses the current web VM's private IP as the source and the current app VM's private IP as the destination.
- ✓ B.An inbound rule with source WebASG, destination AppASG, protocol TCP, and destination port 8443.
- C.A route table that sends TCP 8443 traffic from the web subnet to the app subnet.
- D.An Azure Firewall application rule collection that permits all traffic between the two subnets.
Why B: Application security groups (ASGs) allow you to configure network security as a natural extension of an application's structure, enabling you to group VMs by their roles (e.g., web tier, app tier) and define rules based on those groups. By creating an inbound NSG rule with source WebASG and destination AppASG on TCP port 8443, any VM added to WebASG can initiate traffic to any VM in AppASG, and future scale-outs are automatically included without manual IP updates. This approach is dynamic, scalable, and aligns with the requirement for automatic inclusion of new VMs.
Variation 2. A team manages many application VMs and backend VMs. The VM IP addresses change whenever they are rebuilt, but the same traffic rule must always allow the app tier to reach the backend tier on TCP 8443. What should the administrator use in the NSG rule?
easy- A.Static private IP addresses for each virtual machine.
- ✓ B.Application Security Groups for the app and backend VMs.
- C.A user-defined route between the app and backend subnets.
- D.An availability set for each tier.
Why B: Application Security Groups (ASGs) allow you to group VMs logically and reference them directly in NSG rules without relying on static IP addresses. Since the VM IPs change on rebuild, ASGs ensure the NSG rule for TCP 8443 always applies to the correct app and backend tiers, regardless of IP changes.
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This AZ-104 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the AZ-104 exam.