Business Challenge
#102 covered the reactive tools: a connection is broken, and you need to know why. This post is the other question, the one that arrives from an auditor, a finance team or a migration plan rather than from an incident. What is actually talking to what?
Nobody can answer that from configuration. A network security group lists what is permitted; the set of flows that actually happen is a different and usually much smaller set, and the gap between them is where decommissioning plans, segmentation projects and compliance evidence all live. Flow logs are the only record of the second set.
There is also a deadline attached, which is the practical reason to read this now rather than next year.
NSG flow logs retire on 30 September 2027, and already cannot be created
“Network security group (NSG) flow logs retire on September 30, 2027. Because the feature is retiring, it no longer supports new NSG flow logs creation.” After that date Azure “no longer supports traffic analytics enabled for NSG flow logs, and deletes existing NSG flow log resources in your subscriptions.”
One mercy in the wording: “Azure doesn't delete existing NSG flow log records from Azure Storage, and they continue to follow their configured retention policies.” The history survives; the collector does not. So this is not an optional modernisation — the clock is running on anything still logging at the NSG.
Architecture
Why the scope moved from the NSG to the virtual network
The old model logged at a network security group, which meant logging twice: NSG flow logs require configuration “at both the subnet and the network interface” to get complete coverage. Virtual network flow logs are enabled once, on the virtual network, and “traffic through all supported workloads within a virtual network is recorded.”
That is a simplification, but the capability gap is the bigger story. Several things only the newer logs can see:
| Scope | NSG flow logs | VNet flow logs |
|---|---|---|
| Bytes and packets in stateless flows | Not supported | Supported |
| Identification of virtual network encryption | Not supported | Supported |
| Azure API Management | Not supported | Supported |
| Azure Application Gateway | Not supported | Supported |
| Azure Virtual Network Manager rules | Not supported | Supported |
| ExpressRoute gateway | Not supported | Supported |
| VPN gateway | Not supported | Supported |
| ExpressRoute FastPath | Not supported | Not supported |
Gateways are the entry that changes a bill. Because the logs operate at the virtual network level they “capture traffic for resources such as gateways by default”, and the documentation is candid that this “can lead to a higher volume of log data.” Enabling this on a hub virtual network records everything crossing the hub.
Do not leave both enabled
“We recommend disabling network security group flow logs before enabling virtual network flow logs on the same underlying workloads to avoid duplicate traffic recording and additional costs.” And if you do both: “you might get duplicate logging or only virtual network flow logs” — an outcome that is not even deterministic. Turn the old one off first.
Why This Architecture Holds Up
Because the byte counts are deltas, not totals
This is the single most common way flow log analysis goes wrong. A conversation produces several tuples — one at Begin, some at Continuing, one at End — and “for continuation (C) and end (E) flow states, byte and packet counts are aggregate counts from the time of the previous flow's tuple record.”
They are deltas. You sum them. Microsoft's own worked example makes the point better than any warning: a single TCP conversation yields packet counts of 1,021, 52, 8,005 and 47, “the total number of packets transferred is 1,021 + 52 + 8,005 + 47 = 9,125”, and the bytes come to 5,256,000. Take the largest tuple instead of summing and you under-report by more than half.
Because “unencrypted” and “dropped” share a prefix
The encryption field has eight values, and they are not a simple encrypted/not-encrypted pair. Three of them mean the packet was discarded, which makes them availability signals rather than compliance signals:
| Status | Meaning | Packet |
|---|---|---|
X | Encrypted, as configured | Delivered |
NX | Unencrypted — the default for every virtual network | Delivered |
NX_LOCAL_DST | Source and destination on the same Azure host — “isn't encrypted by design” | Delivered |
NX_FALLBACK | Allow-unencrypted policy; encryption was attempted and failed | Delivered |
NX_SW_NOT_READY | Host stack not ready — VM starting, restarting, or host being updated | Dropped |
NX_NOT_ACCEPTED | Drop-on-unencrypted policy both ends; encryption failed | Dropped |
NX_NOT_SUPPORTED | Host networking stack can't do discovery — report to Microsoft | Dropped |
NX_HW_NOT_SUPPORTED | FPGA not attached or faulty — report to Microsoft | — |
NX_SW_NOT_READY is the one worth an alert. It fires on VM boot, on redeploy, and “when there's an update to the networking components on the host” — events you do not control — and during it the packet is dropped. The documentation says “the problem should be temporary”, which is true and is also a description of an intermittent connectivity fault that will be reported to you as an application bug.
One more: a flow denied because of encryption carries an aclID and rule name of unspecified. If your query joins flows to NSG rules, those records fall out of the join and the drop becomes invisible.
Because traffic analytics aggregates again, and drops the source port
Traffic analytics “reduces the log volume by aggregating flows that have a common source IP address, destination IP address, destination port, and protocol.” The documented example: two hosts communicating 100 times in an hour produce 100 raw entries and one reduced entry saying they communicated 100 times over HTTP on port 80.
The precise key is source IP, destination IP, destination port, NSG name, NSG rule, flow direction and transport protocol — and the schema page states the exclusion explicitly: “source port is excluded for aggregation.” That is the right call for volume and it costs you a specific capability: you cannot count distinct connections from a Log Analytics row, because every ephemeral source port collapsed into it.
The portal and Log Analytics will disagree. Both are correct.
“For any resource in traffic analytics, the flows indicated in the Azure portal are total flows seen, but in Azure Monitor logs, user sees only the single, reduced record. To see all the flows, use the blob_id field, which can be referenced from storage.”
So when someone's KQL row count doesn't match the dashboard, nothing is broken. The dashboard counts flows; the table counts reduced records. blob_id is the documented path back to the raw truth, and the one to reach for when an auditor wants individual connections rather than conversation summaries.
Latency compounds across the two stages. Blobs land at one-minute intervals; traffic analytics picks them up every 60 minutes by default, or every 10 minutes if you select the shorter interval — six times more often; and then “this process can take up to 1 hour” to reach Azure Monitor logs. Flow logs are an inventory, not a monitor. For anything that needs to page someone, use the tools from #102.
Two schema details that save a rewrite. The table is NTANetAnalytics at FASchemaVersion 3, and it “replaces AzureNetworkAnalytics_CL used in network security group flow logs” — so every saved query, workbook and alert built on the old table has to be rewritten as part of the migration, not after it. And the suffixes mislead: “some field names are appended with _s or _d, which don't signify source and destination but indicate the data types string and decimal.”
Because the enrichment is the actual product
Raw flows are IP addresses. What makes traffic analytics worth its processing fee is that it resolves them into topology: subscription, region, NIC, VM, subnet, load balancer, application gateway, ExpressRoute circuit and peering type, local network gateway, connection name, and the hub virtual networks in a hub-and-spoke path. Then it classifies every flow into one of nine types — IntraVNet, InterVNet, S2S, P2S, AzurePublic, ExternalPublic, MaliciousFlow, Unknown Private, Unknown.
Those last two are the useful ones for an audit. Unknown means traffic analytics “was unable to map either of the IP addresses in the flow with the customer topology in Azure and on-premises” — traffic whose endpoints nobody can name. MaliciousFlow means the far end appeared in the threat feeds for that interval, and those records carry a DNS domain, URL, port and one of eleven ThreatType values including C2, CryptoMining, Botnet and Phishing.
Enrichment has a visibility boundary
“A subscription is visible to traffic analytics in a Log Analytics workspace if it contains a flow log configured to that workspace.”
So a flow to a VM in a subscription that is not sending logs to the same workspace cannot be resolved, and gets classified as ExternalPublic or Unknown rather than InterVNet. In a large estate that misclassifies internal traffic as external, which is exactly backwards for a segmentation review. Centralise the workspace before you trust the flow-type distribution.
Because there are places the record does not exist at all
A log with gaps you do not know about is worse than no log, so these are worth reading as a list of questions your evidence cannot answer:
- ExpressRoute egress. “Outbound flows from virtual machines (VMs) to ExpressRoute circuit aren't recorded if flow logging is enabled on the ExpressRoute gateway subnet” — they must be captured at the VM's subnet or NIC instead. And FastPath, from #76, bypasses the gateway, so that traffic is not recorded there either.
- Twelve platform services. Container Instances, Container Apps, Logic Apps, Functions, DNS Private Resolver, App Service, Database for MariaDB, MySQL and PostgreSQL, SQL Managed Instance, NetApp Files and Power Platform. An App Service plan deployment is explicitly excluded.
- API Management, conditionally. Traffic analytics “currently supports only Azure API Management instances deployed using VNet Injection”; VNet Integration deployments are not supported.
- Private endpoint NICs. Version 5's Private Link context “applies only to Private Link Service (PLS) traffic captured at the backend” — capture at the private endpoint NIC is not supported. See #91.
And the storage account has its own set of ways to stop logging quietly: it must be in the same region, it must be Standard because premium is unsupported, and “if you change or rotate the customer-managed encryption keys to your storage account, virtual network flow logs stop working” — the fix being to disable and re-enable the flow log. A key rotation policy and a flow log are therefore on a collision course unless somebody wrote it down. There is also a sharp operational rule: logs are appended to a block blob, and editing, overwriting or deleting that blob mid-hour “can cause all subsequent flow log write operations to fail for that specific hour's blob.”
Because the migration has a one-way door
The migration tooling splits by shape of estate: use Azure Policy when every NIC and subnet in a virtual network shares the same NSG and the same flow log configuration, and the migration script when they do not, or when you deliberately want to preserve differing configurations.
The script asks one question that decides your resource count: migration with aggregation produces a single flow log on the virtual network, so an NSG attached to three NICs in one virtual network becomes one resource; without aggregation produces three, one per NIC. Fewer resources is usually right, and more resources preserves per-NIC configuration differences.
Two warnings in the documentation deserve to be read as written. “Once you start running the script, you shouldn't make any changes to the topology in the regions and subscriptions of the flow logs that you're migrating” — so this is a change-freeze activity. And on the confirmation prompt: “Once you accept the changes, you can't revert them.” Keep the analysis report; it is the only record of what the script decided.
Key Architecture Decisions
| Decision | Do this | Because |
|---|---|---|
| Still on NSG flow logs | Migrate on a plan, not on the deadline | Retire 30 September 2027; new ones already blocked; resources deleted after. |
| Enabling VNet flow logs | Disable the NSG flow logs first | Otherwise duplicate recording, double cost, and a non-deterministic outcome. |
| Where to enable | Virtual network level | One resource instead of subnet plus NIC; gateways included automatically. |
| Hub virtual network | Budget for it before enabling | Gateway traffic is captured by default, and that is the highest-volume traffic you have. |
| Computing bandwidth from tuples | Sum the C and E records | Counts are deltas since the previous tuple, not running totals. |
| Counting connections | Go to the blob, not the table | Traffic analytics excludes source port from its aggregation key. |
| Alerting on connectivity | Don't use flow logs | 60-minute default interval plus up to an hour of ingestion. |
| Need faster insight | 10-minute processing interval | Six times more frequent; ingestion latency still applies. |
| Multi-subscription estate | One central workspace | Unlogged subscriptions can't be resolved, so internal traffic reads as external. |
| Existing KQL, workbooks, alerts | Rewrite as part of the migration | NTANetAnalytics replaces AzureNetworkAnalytics_CL; schema version 3. |
| Customer-managed keys on the log storage account | Document the dependency | A key rotation stops logging until the flow log is disabled and re-enabled. |
| Building a parser | Branch on flowLogVersion | Version 5 appends three fields; don't infer positions from the sample. |
| Evidence for a segmentation review | Query Unknown and MaliciousFlow first | Unnameable endpoints and threat-feed hits are the findings; the rest is inventory. |
Closing Thought
The thing I would want a new engineer to understand about flow logs is that there are two lossy steps between a packet and a dashboard, and each one was a deliberate trade. The first turns packets into one-minute tuples with delta counters, which is why you have to add them up. The second turns tuples into one row per conversation shape, which is why the source port is gone and why the portal's number is bigger than your query's.
Neither step is a bug, and neither is documented anywhere a person will look before they write their first query. The cost of not knowing is a number in a compliance report that is wrong by a factor nobody can explain — and flow logs are precisely the artefact people reach for when they need to be believed.
The one line to take away
Flow logs are an inventory, not a monitor: at a 60-minute default interval plus up to an hour of ingestion, they will tell you what talked to what yesterday with real authority, and they will never tell you what is broken right now.
Next in the series: network segmentation patterns for regulated workloads — where this inventory stops being interesting and starts being the evidence.
Official Azure Reference
- Virtual network flow logs overview, Azure Network Watcher — the Layer 4 scope and one-minute collection, the full tuple format for versions 2 and 5, the flow states and the delta-counting rule with its worked bandwidth example, the eight encryption statuses and which drop the packet, the unspecified aclID for encryption denials, version 5's Private Link fields and their three-region availability, the networkInterfaceIP array, platform rules, the storage account constraints including Standard-only and the customer-managed key behaviour, the retention rule limits, the blob append warning, the ExpressRoute gateway and FastPath gaps, the twelve unsupported services, the pricing and free tier, and the capability comparison against NSG flow logs
- Traffic analytics schema and data aggregation — the 60-minute default and 10-minute processing intervals, the aggregation key and the deliberate exclusion of source port, the up-to-one-hour ingestion delay, FlowStartTime and FlowEndTime semantics, the portal-versus-Log-Analytics count difference and blob_id, the NTANetAnalytics and NTAIpDetails tables replacing the older _CL tables, schema version 3, the nine flow types and their definitions, the eleven threat types, the AllowedInFlows family of counters, the UDR-hop and dual-stack capture fields, the _s and _d suffix meaning, the workspace visibility rule, and the 2019 schema change
- Traffic analytics overview, Azure Network Watcher — the volume-reduction model and its hundred-to-one example, the geography, security and topology enrichment, the required components, the cross-region Log Analytics workspace allowance with no transfer charge, and the list of insights it produces
- Migrate to virtual network flow logs — the retirement date and what Azure deletes versus retains, the choice between Azure Policy and the migration script, the PowerShell and RBAC prerequisites, the sixteen-thread default, the difference between migration with and without aggregation, the change-freeze and no-rollback warnings, and the unsupported cross-subscription PaaS case
- Network security group flow logs overview — the model being retired, for comparison (no claims drawn from it)
- Virtual network encryption — what has to be configured before any flow reports an encrypted status (no claims drawn from it)
Comments