An NSG is like a security guard for your cloud network. It controls which traffic can enter or leave your virtual machines by using rules that allow or block traffic based on source, destination, port, and protocol.
Click to reveal answer
beginner
How do NSG rules work in Azure?
NSG rules check network traffic against a list of rules in order. Each rule either allows or denies traffic based on conditions like IP address, port, and protocol. The first matching rule decides if the traffic is allowed or blocked.
Click to reveal answer
beginner
What are the two main types of NSG rules?
Inbound rules control traffic coming into a resource. Outbound rules control traffic leaving a resource. Both help protect your cloud resources by filtering traffic.
Click to reveal answer
intermediate
Where can you apply an NSG in Azure?
You can apply an NSG to a subnet or directly to a network interface of a virtual machine. This lets you control traffic at different levels in your network.
Click to reveal answer
intermediate
Why is it important to have a default deny rule in NSGs?
A default deny rule blocks all traffic that does not match any allow rule. This ensures only traffic you explicitly allow can reach your resources, improving security by preventing unwanted access.
Click to reveal answer
What does an NSG primarily control in Azure?
AUser login permissions
BStorage account access
CNetwork traffic to and from resources
DVirtual machine size
✗ Incorrect
NSGs control network traffic by allowing or blocking it based on rules.
Which of the following is NOT a condition you can use in an NSG rule?
AUser password
BDestination port
CSource IP address
DProtocol type
✗ Incorrect
NSG rules do not use user passwords; they filter traffic based on network parameters.
Where can you apply an NSG in Azure?
AOn a storage account
BOn a subnet or network interface
COn a database
DOn a virtual machine's operating system
✗ Incorrect
NSGs are applied to subnets or network interfaces to control traffic.
What happens if no NSG rule matches the network traffic?
ATraffic is denied by default
BTraffic is redirected
CTraffic is logged but allowed
DTraffic is allowed by default
✗ Incorrect
NSGs have a default deny rule that blocks traffic not matching any allow rule.
Which type of NSG rule controls traffic leaving a resource?
AFirewall rule
BInbound rule
CAccess rule
DOutbound rule
✗ Incorrect
Outbound rules control traffic leaving a resource.
Explain how Network Security Groups (NSGs) help protect Azure resources.
Think about how a security guard checks who can enter or leave a building.
You got /4 concepts.
Describe the difference between inbound and outbound NSG rules.
Consider traffic coming to and leaving from your house.
You got /4 concepts.
Practice
(1/5)
1. What is the primary purpose of an Azure Network Security Group (NSG)?
easy
A. To monitor application performance
B. To store data securely in Azure Blob Storage
C. To control inbound and outbound traffic to Azure resources
D. To manage user identities and access
Solution
Step 1: Understand NSG function
NSGs are designed to filter network traffic to and from Azure resources.
Step 2: Identify correct purpose
They do not store data, manage identities, or monitor performance.
Final Answer:
To control inbound and outbound traffic to Azure resources -> Option C
Quick Check:
NSG controls traffic [OK]
Hint: NSG controls network traffic, not data or users [OK]
Common Mistakes:
Confusing NSG with storage or identity services
Thinking NSG monitors performance
Assuming NSG stores data
2. Which of the following is the correct way to specify a rule priority in an NSG rule?
easy
A. Priority is a string describing the rule
B. Priority is an IP address range
C. Priority is a boolean value true or false
D. Priority must be a unique integer between 100 and 4096
Solution
Step 1: Understand NSG rule priority format
NSG rule priority is a unique integer between 100 and 4096 that determines rule evaluation order.
Step 2: Eliminate incorrect types
Priority is not a string, boolean, or IP range.
Final Answer:
Priority must be a unique integer between 100 and 4096 -> Option D
Quick Check:
Priority = integer 100-4096 [OK]
Hint: Priority is a number from 100 to 4096 [OK]
Common Mistakes:
Using strings or booleans for priority
Confusing priority with IP ranges
Not using unique priority numbers
3. Given this NSG rule: Priority: 200, Direction: Inbound, Access: Deny, Source: Any, Destination: 10.0.0.4, Protocol: TCP, Port: 22 What happens when a user tries to SSH (port 22) to 10.0.0.4?
medium
A. The connection is denied
B. The connection is allowed only if from a specific IP
C. The connection is allowed
D. The connection is logged but allowed
Solution
Step 1: Analyze rule details
The rule denies inbound TCP traffic on port 22 to destination 10.0.0.4 from any source.
Step 2: Determine effect on SSH connection
SSH uses TCP port 22, so the connection attempt matches the deny rule and is blocked.
Final Answer:
The connection is denied -> Option A
Quick Check:
Deny inbound TCP port 22 = connection denied [OK]
Hint: Deny inbound on port 22 blocks SSH connections [OK]
Common Mistakes:
Assuming 'Any' source means allow
Confusing deny with logging
Ignoring direction and port in rule
4. You created an NSG rule to allow inbound HTTP traffic on port 80, but the traffic is still blocked. What is the most likely cause?
medium
A. The NSG is not attached to the subnet or network interface
B. A higher priority deny rule blocks port 80 traffic
C. The source IP address is not specified
D. The protocol is set to UDP instead of TCP
Solution
Step 1: Check rule priority and conflicts
NSG rules are evaluated by priority; a deny rule with higher priority can block traffic despite allow rules.
Step 2: Confirm rule attachment and protocol
While attachment and protocol matter, the most common cause is a conflicting higher priority deny rule.
Final Answer:
A higher priority deny rule blocks port 80 traffic -> Option B
Quick Check:
Higher priority deny overrides allow [OK]
Hint: Check for higher priority deny rules first [OK]
Common Mistakes:
Ignoring rule priority order
Assuming NSG attachment is always correct
Confusing protocol types
5. You want to restrict access so only a specific IP address (203.0.113.5) can access a VM on port 3389 (RDP). Which NSG rule configuration achieves this securely?
Step 1: Allow only specific IP inbound on port 3389
Priority: 300, Direction: Inbound, Access: Allow, Source: 203.0.113.5, Destination: Any, Protocol: TCP, Port: 3389 allows inbound TCP traffic on port 3389 only from IP 203.0.113.5, which matches the requirement.