Read VNet flow evidence and effective security rules
Use a recorded tuple and rule name to explain an allowed or denied workload connection.
Read VNet flow evidence and effective security rules
Work through the decision
A monitoring panel shows denied inbound connections to a service. An administrator proposes opening a broad port range before identifying the affected clients. What evidence should narrow the change?
Check your reasoning
Select a relevant time window and source network, then inspect the VNet flow records for direction, source and destination, protocol, destination port, flow state and the recorded rule. Compare with the intended connection contract. Check effective NSG rules on both subnet and NIC, applicable administrative rules and the relevant ASG memberships. Use Network Watcher IP flow verify on a specific expected VM flow to check the current rule decision.
Compare the choices
- NSG rule priority
- Order specific allowed or denied flows against broader rules within the same NSG. Compare direction, protocol, source, destination and port.
- Application security group
- Group supported workload NIC IP configurations by role and reference those roles in NSG rules. Maintain membership as the application scales.
- Virtual network flow logs
- Collect flow-level evidence at supported scopes to storage and optionally analyze aggregated patterns. Interpret captured states and counters within their schema.
- IP flow verify
- Check whether a specified VM flow is allowed or denied under applicable security rules and identify the deciding rule. It evaluates a particular tuple.
Test the decision
An NSG evaluates matching rules by priority for new flows. Smaller priority numbers run first within that rule list. Stateful behavior affects replies. Baseline a known permitted request and a known denied request, then test a narrowly scoped correction. Use the Bastion management path for appropriate administrative access and account for its required service flows.
Interpret the flow-log version
Inspect flowLogVersion before selecting tuple positions. For the version used below, the flow state follows the direction. C and E records carry counter changes since the last update. A deny record identifies a network disposition. Use the timestamp, address pair, ports and rule to find the corresponding application or firewall evidence.
Microsoft Learn · VNet flow log format and counters
Practice the guide skills
- Build a minimal NSG rule set with named priorities for a web tier’s expected traffic. Watch 2:26:11
- Determine which subnet and NIC NSGs participate in an inbound decision. Watch 2:26:41
- Define application security groups for frontend, application and data roles. Watch 2:26:59 · Continue at 2:28:04
- Assign workload NIC configurations to those groups and replace a fragile address list in a rule. Watch 2:27:01 · Continue at 2:28:04
- Evaluate the first matching rule for an inbound tuple, then inspect the independent outbound rules. Watch 2:26:11 · Continue at 2:26:41
- Choose the target VNet, supported storage account and retention plan for VNet flow logs. Watch 2:27:10 · Continue at 2:27:23
- Read a versioned flow tuple and compare its time window and direction with Traffic Analytics. Watch 2:27:10 · Continue at 2:27:35
- Use IP flow verify on a specified VM, direction, protocol and ports to identify the deciding NSG rule. Watch 2:27:48
- Draw the permitted Bastion-to-VM management path and required subnet rules. Watch 2:28:44 · Continue at 2:29:21
- Compare a central security admin rule with the workload NSG and predict whether NSG evaluation continues. Watch 2:30:33
Official objectives for this lesson
Lab · Investigate a VNet flow log
A depot reports failed HTTPS connections to 10.8.1.4. Use Python 3 to analyze this synthetic excerpt of the version 4 VNet flow-log schema. Predict the number of inbound denies for the service and the response bytes in its permitted flow.
from collections import Counter
groups = [
{"rule": "DenyOtherInbound", "flowTuples": [
"1796288400000,192.0.2.18,10.8.1.4,41001,443,6,I,D,NX,0,0,0,0",
"1796288402000,192.0.2.19,10.8.1.4,41002,443,6,I,D,NX,0,0,0,0",
"1796288404000,192.0.2.18,10.8.1.4,41003,80,6,I,D,NX,0,0,0,0",
]},
{"rule": "AllowDepotWeb", "flowTuples": [
"1796288405000,198.51.100.12,10.8.1.4,43001,443,6,I,B,NX,0,0,0,0",
"1796288407000,198.51.100.12,10.8.1.4,43001,443,6,I,C,NX,2,160,1,80",
"1796288409000,198.51.100.12,10.8.1.4,43001,443,6,I,E,NX,1,70,2,180",
]},
]
record = {"flowLogVersion": 4, "flowRecords": {"flows": [{"flowGroups": groups}]}}
assert record["flowLogVersion"] == 4
denies = Counter()
response_bytes = 0
for flow in record["flowRecords"]["flows"]:
for group in flow["flowGroups"]:
for entry in group["flowTuples"]:
(time, src, dst, sport, dport, proto, direction, state,
encryption, sent_pkts, sent_bytes, recv_pkts, recv_bytes) = entry.split(",")
if (dst, dport, proto, direction) != ("10.8.1.4", "443", "6", "I"):
continue
if state == "D":
denies[group["rule"]] += 1
if state in ("C", "E"):
response_bytes += int(recv_bytes)
for rule, count in sorted(denies.items()):
print(rule, count)
print("response bytes:", response_bytes)
Check the result
DenyOtherInbound 2 response bytes: 260
The port-80 record is outside the incident. Beginning, continuing and ending records can describe one permitted connection. Its byte updates are deltas, so 80 + 180 = 260 response bytes. Correlate with the application log to establish the HTTP outcome. Change the destination-port filter to 80 and predict both outputs.
Related lesson · Evaluate security rules and private endpoints
Read VNet flow evidence and effective security rules quiz
Answer 3 questions. Check each answer for an explanation.
Worked example · Read VNet flow evidence and effective security rules