Question 880 of 1,049
Understanding NSG Rule Priority Order in Azure
An application subnet has an NSG outbound rule Deny-HTTPS at priority 200 for TCP 443 to Any. A second outbound rule Allow-HTTPS-API at priority 300 permits TCP 443 from ASG-Web to ASG-Api. Web servers can reach other ports but not the API. What change should the administrator make?
Quick Answer
The correct answer is to change the allow rule to a higher priority than 200, such as 100. This is because Azure NSG rule priority order dictates that rules are evaluated from the lowest priority number to the highest, meaning a rule at priority 100 is processed before a rule at priority 200. Since the Deny-HTTPS rule at priority 200 blocks all outbound TCP 443 traffic, the Allow-HTTPS-API rule at priority 300 never gets a chance to match the traffic from ASG-Web to ASG-Api. On the AZ-104 exam, this scenario tests your understanding of how NSG rule precedence works, often appearing as a common trap where students assume a more specific rule overrides a general deny, forgetting that priority order is evaluated first. A reliable memory tip is to think of priority numbers like a race: the lowest number wins the evaluation, so a deny at 200 will always block a permit at 300, regardless of specificity.
⚠ Common exam trap
Candidates often assume more specific rules (like those using application security groups) are evaluated before general deny rules, but in Azure NSGs, priority numbers alone determine evaluation order, not specificity.
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
✓
Change the allow rule to a higher priority than 200, such as 100.
NSG rules are evaluated in priority order, with lower numbers having higher precedence. The Deny-HTTPS rule at priority 200 blocks all outbound TCP 443 traffic, including traffic from ASG-Web to ASG-Api. To allow the specific traffic, the Allow-HTTPS-API rule must have a lower priority number (e.g., 100) so it is evaluated before the deny rule, permitting the desired traffic while the deny rule still blocks other outbound HTTPS 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.
- ✗
Delete the deny rule so the allow rule can be evaluated.
Why it's wrong here
Removing the deny rule is unnecessary if the allow rule is given a higher priority.
When this WOULD be correct
If the question stated that the deny rule was unnecessary and could be removed without affecting security requirements, and the goal was to allow HTTPS traffic to the API, then deleting the deny rule would be correct. For example, if the deny rule was mistakenly added and the allow rule was intended to be the only rule governing HTTPS traffic.
- ✓
Change the allow rule to a higher priority than 200, such as 100.
Why this is correct
NSGs process the lowest priority number first. Moving the allow rule above the deny rule permits the traffic.
- ✗
Change the destination from ASG-Api to the entire subnet address range.
Why it's wrong here
The destination address form is not the issue; the deny rule still wins because of priority.
When this WOULD be correct
If the NSG had no deny rule and the allow rule was too restrictive (e.g., only allowing traffic to a specific IP that is not the API server), then expanding the destination to the entire subnet address range could permit the required traffic.
- ✗
Change the protocol from TCP to Any so the rule matches more traffic.
Why it's wrong here
The rule already matches TCP 443 traffic; protocol widening does not resolve a higher-priority deny.
When this WOULD be correct
In a scenario where an NSG rule is too restrictive on protocol (e.g., only allowing TCP but the application requires UDP), changing the protocol to Any would permit all traffic types, potentially fixing connectivity issues caused by protocol mismatch.
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.
✓Change the allow rule to a higher priority than 200, such as 100.Correct answer▾
Why this is correct
NSGs process the lowest priority number first. Moving the allow rule above the deny rule permits the traffic.
✗Delete the deny rule so the allow rule can be evaluated.Wrong answer — click to see why▾
Why this is wrong here
In Azure, NSG rules are evaluated in priority order (lowest number first). The deny rule at priority 200 is evaluated before the allow rule at priority 300, so deleting the deny rule would allow the allow rule to work, but the question asks for a change to fix the issue without deleting the deny rule. The correct fix is to increase the priority of the allow rule.
★ When this WOULD be the correct answer
If the question stated that the deny rule was unnecessary and could be removed without affecting security requirements, and the goal was to allow HTTPS traffic to the API, then deleting the deny rule would be correct. For example, if the deny rule was mistakenly added and the allow rule was intended to be the only rule governing HTTPS traffic.
Why candidates choose this
Candidates may think that removing a blocking rule is the simplest solution, not realizing that NSG rules are evaluated in priority order and that the deny rule can coexist with a higher-priority allow rule. They might also overlook that the question implies the deny rule should remain for other traffic.
✗Change the destination from ASG-Api to the entire subnet address range.Wrong answer — click to see why▾
Why this is wrong here
The allow rule already permits traffic to ASG-Api, but the deny rule at priority 200 blocks it before the allow rule at priority 300 is evaluated. Changing the destination to the entire subnet would not resolve the priority issue; the deny rule would still block traffic to the subnet.
★ When this WOULD be the correct answer
If the NSG had no deny rule and the allow rule was too restrictive (e.g., only allowing traffic to a specific IP that is not the API server), then expanding the destination to the entire subnet address range could permit the required traffic.
Why candidates choose this
Candidates may think that the allow rule's destination is too narrow and that widening it to the subnet will override the deny rule, misunderstanding that NSG rules are evaluated in priority order and a higher-priority deny always blocks matching traffic.
✗Change the protocol from TCP to Any so the rule matches more traffic.Wrong answer — click to see why▾
Why this is wrong here
Changing the protocol to Any would not resolve the issue because the Deny-HTTPS rule at priority 200 still blocks TCP 443 traffic regardless of protocol scope. The allow rule at lower priority (300) is never evaluated due to the higher-priority deny.
★ When this WOULD be the correct answer
In a scenario where an NSG rule is too restrictive on protocol (e.g., only allowing TCP but the application requires UDP), changing the protocol to Any would permit all traffic types, potentially fixing connectivity issues caused by protocol mismatch.
Why candidates choose this
Candidates may think that broadening the protocol scope will make the allow rule more effective, overlooking that priority order determines rule evaluation and a higher-priority deny still blocks the traffic.
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?”
Visual reference
About these practice questions
Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →
Same concept, more angles
5 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 in separate subnets. Each VM NIC is placed in an application security group named WebASG or AppASG. The administrator must allow only the web tier to reach the app tier on TCP port 8443 and block all other inbound traffic to the app tier. Which NSG rule should be created on the app subnet?
medium- ✓ A.Allow TCP 8443 from WebASG to AppASG with a priority lower number than the deny rule.
- B.Allow TCP 8443 from the entire virtual network to the app subnet with a lower priority than the deny rule.
- C.Allow UDP 8443 from WebASG to AppASG with any priority below 65000.
- D.Allow TCP 8443 from WebASG to AppASG with a priority higher number than the deny rule.
Why A: NSG rules are evaluated in priority order, with lower numbers having higher priority. By placing an Allow rule for TCP 8443 from WebASG to AppASG with a lower priority number than a subsequent Deny-All rule, only traffic from the web tier is permitted, and all other inbound traffic to the app subnet is blocked. This leverages application security groups (ASGs) to define fine-grained, role-based network security policies without relying on IP addresses.
Variation 2. An application subnet has a network security group with these inbound rules: Allow-Web-From-Internet at priority 200, Allow-App-From-Web at priority 300, and Deny-All-Inbound at priority 250. The web tier must reach the app tier on TCP 8080, but traffic is being denied. The administrator confirms the source and destination IPs are correct. What is the best fix?
medium- A.Delete the Deny-All-Inbound rule because default NSG rules will allow the traffic.
- ✓ B.Change the Allow-App-From-Web rule to a lower priority number than 250.
- C.Add a route table entry for TCP 8080 traffic to bypass the NSG.
- D.Move the Allow-Web-From-Internet rule to priority 400.
Why B: The Deny-All-Inbound rule at priority 250 is evaluated before the Allow-App-From-Web rule at priority 300 because lower priority numbers are processed first. To allow web-to-app traffic on TCP 8080, the Allow-App-From-Web rule must have a lower priority number (e.g., 240) than the Deny-All-Inbound rule so it is evaluated and applied first, permitting the traffic before the deny rule blocks it.
Variation 3. Based on the exhibit, a help desk engineer cannot RDP from an approved admin subnet to a VM in Azure. What change should the administrator make so the connection is allowed?
medium- A.Change the deny rule to use UDP instead of TCP.
- ✓ B.Move Allow-RDP-Admin to a priority lower than 100.
- C.Add the VM NIC to an application security group and leave the rules unchanged.
- D.Delete the default AllowVNetInBound rule.
Why B: The exhibit shows a deny rule with priority 100 that blocks all inbound traffic from the approved admin subnet, and an allow rule for RDP with a priority lower than 100 (e.g., 200). Since Azure Network Security Group (NSG) rules are evaluated in priority order (lowest number first), the deny rule at priority 100 is evaluated before the allow rule at a lower priority, thus blocking the RDP connection. To allow the RDP traffic, the administrator must move the Allow-RDP-Admin rule to a priority lower than 100 (e.g., 90) so it is evaluated before the deny rule.
Variation 4. An NSG is associated with a subnet. It contains these inbound rules: - Priority 100: Deny TCP 443 from Internet to Any - Priority 200: Allow TCP 443 from 203.0.113.0/24 to Any A tester at 203.0.113.10 browses to the VM's HTTPS endpoint in that subnet. What happens?
medium- A.The request is allowed because the more specific source range matches first.
- ✓ B.The request is denied because the priority 100 deny rule matches before the allow rule.
- C.The request is denied only if the VM has no public IP address.
- D.The request is allowed because default NSG rules always override custom rules.
Why B: Network Security Group (NSG) rules are evaluated in priority order, from lowest to highest numeric value. The priority 100 rule explicitly denies TCP 443 from the Internet (which includes the 203.0.113.0/24 range), and it is evaluated before the priority 200 allow rule. Since the deny rule matches first, the traffic is blocked regardless of the more specific source IP in the allow rule.
Variation 5. An NSG attached to a subnet contains these inbound rules: Deny-All-Inbound at priority 200, Allow-HTTPS-Admin at priority 250 from 203.0.113.20/32, and Allow-HTTPS-Internet at priority 300. A VM in the subnet cannot receive HTTPS from the admin workstation even though the source IP is correct. What should the administrator change?
medium- A.Change the protocol from TCP to Any on the allow rule.
- ✓ B.Move the Allow-HTTPS-Admin rule to a priority number lower than 200.
- C.Associate a NAT gateway with the subnet.
- D.Enable service endpoint policies on the subnet.
Why B: The Deny-All-Inbound rule at priority 200 blocks all traffic, including HTTPS from the admin workstation, because NSG rules are evaluated in priority order (lowest number first). The Allow-HTTPS-Admin rule at priority 250 is never reached since the deny rule with a higher priority (lower number) matches first. To allow the admin traffic, the allow rule must have a priority lower than 200 (e.g., 150) so it is evaluated before the deny rule.
Last reviewed: Jun 11, 2026
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.
Question Discussion
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
Sign in to join the discussion.