Azure network security group (NSG) flow logs retire on 30 September 2027, so every team that relies on them for network evidence needs a planned move to virtual network (VNet) flow logs and a detection pipeline that understands the new record format. This guide covers what VNet flow logs record, how to migrate without losing coverage or paying twice, how to read the flow tuple, and how to turn the data into detections and investigation evidence for workloads that run as non-human identities.
The wider Azure network control plane, including NSG design, private endpoints and who can change routing, is covered in our Azure Virtual Network Security Guide. This page stays with flow logging: the migration, the data and its use in detection.
This is an independent guide from NHI Mgmt Group, based on Microsoft's public documentation as of November 2026. It is not sponsored or reviewed by Microsoft. Product features change, so confirm settings against Microsoft's current documentation.
Key takeaways
- NSG flow logs retire on 30 September 2027. New NSG flow logs can no longer be created, and after retirement Azure deletes the remaining NSG flow log resources and stops traffic analytics for them. Records already in storage stay under their retention policies.
- VNet flow logs are enabled once per virtual network, subnet or NIC, record traffic evaluated by both NSGs and Azure Virtual Network Manager security admin rules, and add encryption status and byte counts for stateless flows.
- Microsoft provides a migration script (analysis first, then migration with or without aggregation) and two built-in Azure Policy definitions for audit and deployment. Accepting the script's changes cannot be rolled back.
- Disable NSG flow logs before enabling VNet flow logs on the same workload, or the same traffic is recorded and billed twice.
- Parsers, SIEM rules and traffic analytics queries written for NSG flow logs need updating: the schema, the evaluating resource field and the Log Analytics table names change.
- Flow logs are evidence for identity investigations too. When a managed identity or service principal is abused, flow records show where the workload actually connected.
Why the retirement matters to security teams
NSG flow logs have been the default source of network evidence in Azure for years. Many detection rules, incident runbooks and audit evidence packs point at them by name. Microsoft's migration documentation states that NSG flow logs retire on 30 September 2027, that creating new NSG flow logs is no longer supported, and that after retirement Azure stops supporting traffic analytics for NSG flow logs and deletes existing NSG flow log resources. Existing records in Azure Storage are not deleted and continue to follow their configured retention.
The practical risk is a silent gap. New subscriptions and new virtual networks built from older templates may already lack any flow logging, because the NSG option cannot be created there. Existing NSG flow logs will keep working until the retirement date, which encourages teams to defer the work. If the migration is left until late 2027, detection content that queries the old tables will return nothing, and nobody may notice until an investigation needs the data.
Treat the migration as a detection engineering project, not a logging toggle. The output you want is the same or better coverage, parsers and rules proven against the new schema, and evidence that every in-scope virtual network has a flow log.
What VNet flow logs record
According to the VNet flow logs overview, the feature is part of Azure Network Watcher and logs IP traffic through a virtual network at layer 4. The platform collects records at one-minute intervals with no effect on workload performance, writes JSON to an Azure Storage account, and appends to a block blob each minute. From storage the data can be exported to SIEM, visualisation or intrusion detection tools.
The main differences from NSG flow logs are:
- Scope. VNet flow logs are configured once at the virtual network level (or narrower), instead of per NSG at subnet and NIC level.
- Rule source. Records show whether an NSG rule or an Azure Virtual Network Manager security admin rule allowed or denied the traffic. The
aclIDfield identifies the evaluating resource. - Encryption status. Each tuple records whether the flow was encrypted by virtual network encryption.
- Stateless flows. Bytes and packets are recorded for stateless flows as well.
- Coverage. VNet flow logs also cover API Management, Application Gateway, ExpressRoute gateway and VPN gateway traffic, and record gateway traffic by default, which increases volume.
Some services are not covered. The overview lists, among others, Container Instances, Container Apps, Logic Apps, Functions, App Service, DNS Private Resolver, SQL Managed Instance and NetApp Files. Traffic that bypasses the ExpressRoute gateway through FastPath is not recorded, and outbound flows from VMs to an ExpressRoute circuit are missed if logging is only enabled on the gateway subnet. Record those at the VM subnet or NIC instead.
Reading the flow tuple
Each record carries top-level properties including time, flowLogVersion, flowLogResourceID, targetResourceID, macAddress and flowRecords. Inside flowRecords.flows, each entry has an aclID, and each flow group names the rule that made the decision and a list of comma-separated flowTuples.
| Position | Field | Values and notes |
|---|---|---|
| 1 | Timestamp | UNIX epoch |
| 2 and 3 | Source and destination IP | Private or public address |
| 4 and 5 | Source and destination port | Destination port is the main pivot for service identification |
| 6 | Protocol | IANA number, for example 6 for TCP |
| 7 | Direction | I inbound, O outbound |
| 8 | Flow state | B begin, C continuing, E end, D deny |
| 9 | Encryption | X encrypted, NX unencrypted (default), plus reason codes such as NX_HW_NOT_SUPPORTED and NX_FALLBACK |
| 10 to 13 | Packets and bytes sent and received | Totals since the previous tuple for the same flow |
Three practical points for parser authors:
- Branch on version. The overview documents a version 5 schema that adds Private Link Service identifier, source NAT IP and source NAT port, initially in a small set of regions. Write parsers that read
flowLogVersionand tolerate extra fields instead of hard-coding thirteen positions. - Sum, do not take the last value. Byte and packet counts on
CandEtuples are deltas since the previous tuple. Volume for a conversation is the sum across its tuples. - Handle platform and unspecified entries. Platform rule entries describe Azure platform traffic and can be filtered out. Traffic denied for encryption reasons shows
unspecifiedinaclIDandrule, so do not treat those as parsing errors.
Migration options and how to choose
Microsoft offers two routes. The migration script suits environments where NSG flow logging is only on some NICs or subnets, or where existing flow logs have different configurations you want to keep. Azure Policy suits environments where the same NSG and the same flow log settings apply across a virtual network and you want logging at the VNet level.
The migration script
From Network Watcher, under Logs, select Migrate flow logs, choose subscriptions and regions, and download the script and its JSON configuration. The script runs in PowerShell 7 with the Az module and offers three options: run analysis, delete NSG flow logs, or quit. Always run the analysis first. It produces an HTML analysis report per subscription and region, then offers migration with aggregation (one VNet flow log per virtual network) or without aggregation (one VNet flow log per NIC).
The documentation is explicit on three cautions. Do not change topology in the affected regions and subscriptions while the script runs. Keep the script and the analysis report in case of problems. Once you accept the changes at the rollback prompt, they cannot be reverted. After migration, the old NSG flow logs are disabled, and deleting them is a separate manual step.
Two edge cases need manual work. For scale sets behind a load balancer where NICs do not share the same NSG flow log, the script creates a VNet flow log using the configuration of one of the NICs, so check retention and traffic analytics settings afterwards. PaaS environments where the flow log is in your subscription but the target resources are in another subscription are not supported by the script; enable VNet flow logging on those networks directly.
Azure Policy
Two built-in definitions exist. Audit flow logs configuration for every virtual network flags any virtual network with no linked flow log and needs no parameters or remediation identity. Deploy a flow log resource with target virtual network uses DeployIfNotExists and takes the region, a storage account in the same region, the Network Watcher resource group and instance, and a retention period (default 30 days, 0 for no retention policy). It needs a remediation task, which means a managed identity with Contributor or Owner rights at the assignment scope. Compliance can take up to 24 hours to update.
The deploy policy's remediation identity is itself a privileged non-human identity. Scope the assignment to the management group or subscriptions that need it, record the identity in your inventory, and review its role assignment as you would any other automation account. Our Azure Policy and Management Groups Guide covers how to govern these assignments.
Running the migration safely
A sequence that has worked for practitioners:
- Inventory. Assign the audit policy at the top management group to find every virtual network without a flow log, and list all remaining NSG flow logs with their storage accounts, retention and traffic analytics settings.
- Find downstream consumers. Search SIEM rules, workbooks, notebooks, scheduled queries and runbooks for the NSG flow log table names and storage paths. Each one needs a replacement or an explicit decision to retire it.
- Pilot. Migrate one non-production subscription. Compare a day of VNet flow log data against the previous NSG flow log data for the same workloads: flow counts, deny counts and top destinations should be broadly similar, allowing for the new gateway and stateless coverage.
- Update content. Rewrite parsers and rules against the new schema and tables before migrating production. Keep the old rules running until their source is gone.
- Migrate by region and subscription. Run analysis, migrate, verify that NSG flow logs are disabled and VNet flow logs exist, then delete the old resources.
- Enforce. Keep the audit policy assigned permanently, and use the deploy policy or infrastructure as code so new networks get flow logs by default.
Avoid overlap on the same workload. Both the overview and the policy page say to disable NSG flow logs before enabling VNet flow logs on the same workloads, because otherwise traffic is recorded twice and you pay twice.
Storage, cost and integrity controls
The overview sets several storage constraints. The account must be a standard (not premium) account in the same region as the virtual network, in the same subscription or one in the same Microsoft Entra tenant. Logs are appended to a block blob each minute, and editing, overwriting or deleting the blob during ingestion can make later writes for that hour fail. Rotating customer-managed keys on the storage account stops logging until flow logs are disabled and re-enabled, so add a post-rotation check to your key rotation runbook.
Pricing, per the overview, is per GB of flow logs collected with a 5 GB per month free allowance per subscription; traffic analytics is billed per GB processed with no free tier; storage is billed separately. Gateway traffic is recorded by default, which can raise volume after migration. Budget for it rather than turning logging off later.
From a security point of view the storage account is an evidence store. Protect it accordingly:
- Restrict write and delete to the Network Watcher service path and a small break-glass group. Few humans need data plane access to raw flow logs.
- Disable shared key access where your ingestion path allows it, and avoid long-lived SAS tokens for SIEM collectors. Our Azure Storage Security Guide covers the options.
- Set lifecycle and retention to meet your investigation window, not just the default 30 days that the deploy policy proposes. Many incident timelines reach back further than a month.
- Alert on deletion or modification of flow log resources and on changes to the storage account's network rules, using the Activity Log. Disabling logging is a classic step before lateral movement.
Traffic analytics and Log Analytics tables
Traffic analytics processes flow logs, enriches them with topology, geography and security information, and stores aggregated results in a Log Analytics workspace. It reports open ports, applications reaching the internet, VMs that talk to rogue networks, top talkers and most-blocking rules.
The traffic analytics schema is where most query breakage happens. For VNet flow logs, flow records go to NTANetAnalytics (with SubType of FlowLog), replacing AzureNetworkAnalytics_CL used for NSG flow logs. Public IP enrichment, including threat details, goes to NTAIpDetails, replacing AzureNetworkAnalyticsIPDetails_CL. Processing runs every 60 minutes by default, or every 10 minutes if you choose the faster interval. Choose 10 minutes for any workspace that feeds detections.
Key fields in NTANetAnalytics include FlowType (for example IntraVNet, InterVNet, ExternalPublic and MaliciousFlow), SrcIp, DestIp, DestPort, FlowDirection, FlowStatus, the allowed and denied in and out flow counts, and AclGroup and AclRule. A flow is classed as MaliciousFlow when one side is in an Azure virtual network and the other is a public IP reported in Microsoft's security feeds for that interval; NTAIpDetails then carries ThreatType values such as C2, Botnet, CryptoMining and Malware.
Traffic analytics aggregates, so it is good for hunting and dashboards but loses per-minute detail. Keep the raw blobs for forensic reconstruction.
Detection use cases
Flow logs answer "who talked to whom, on which port, and how much". These starting points map to MITRE ATT&CK techniques and work on either raw tuples or traffic analytics tables. Tune thresholds to your environment.
- Allowed flows to known malicious infrastructure. Alert on
FlowType == "MaliciousFlow"withFlowStatus == "A"and outbound direction, joined toNTAIpDetailsforThreatType. C2 and cryptomining hits from a VM often follow credential theft or a malicious extension. - Internal scanning. A single source reaching many distinct destination IPs or ports in an hour, especially with many deny states, suggests network service discovery (T1046).
- Unusual lateral movement. New east-west flows on management ports such as 22, 3389, 5985 and 5986 between hosts that have never communicated point to remote services abuse (T1021). Baseline per subnet.
- Large outbound transfers. Sum sent bytes per source and external destination per day, and alert on large departures from baseline or on transfers over unusual protocols (T1048).
- Workload identity abuse. When a VM's managed identity is used from an unexpected place, flow logs show whether the VM itself connected to new endpoints at that time. Pair flow logs with sign-in logs for managed identities and service principals to separate token theft from on-host misuse.
- Encryption policy drift. Where you require virtual network encryption, track
NX_FALLBACKand otherNXreason codes between hosts that should be encrypted. - Logging tampering. Combine a gap in flow records for a busy virtual network with Activity Log events that delete or disable flow logs or change Network Watcher.
For SIEM onboarding and rule management in Microsoft's stack, see our Microsoft Sentinel Guide. For collecting the control plane events that sit next to flow logs, see the Azure Monitor, Activity Log and Diagnostic Settings Guide.
Using flow logs in investigations
During an incident, flow logs fill three gaps that identity logs alone leave open:
- Blast radius. Once a compromised VM or identity is known, list every destination it reached after the first suspicious event. This shapes containment and which secrets to rotate.
- Exfiltration estimate. Summed bytes sent to external destinations give a defensible upper bound for data loss reporting, though not content.
- Timeline anchoring. Begin and end tuples give minute-level start and stop times for sessions, which helps align Activity Log, sign-in and endpoint data.
Write down in advance who can query the raw blobs, how long retrieval takes and which tool parses them. If the only person who knows the storage path is on leave, the evidence is not much use.
Common failure patterns
- Waiting for the deadline. Teams defer migration because NSG flow logs still work, then discover new networks have had no flow logging for months.
- Double logging. VNet flow logs are enabled while NSG flow logs stay on for the same workloads, doubling cost and confusing counts.
- Broken queries. Detection rules keep querying
AzureNetworkAnalytics_CLafter the source moves toNTANetAnalytics, and return nothing without error. - Hard-coded parsers. Parsers assume a fixed number of tuple fields and fail or misread data when version 5 fields appear.
- Last value, not sum. Analysts read bytes from the final tuple of a flow and understate transfers.
- Unprotected evidence. Flow log storage allows broad write or delete access, shared keys or long-lived SAS tokens.
- Key rotation stops logging. Customer-managed key rotation on the storage account halts logging and nobody re-enables it.
- Assumed coverage. Teams assume PaaS services such as Functions or App Service are covered when they are not.
Practitioner checklist
- Assign the built-in audit policy for VNet flow logs at the top management group and track non-compliant networks to zero.
- Inventory all NSG flow logs and every rule, workbook and runbook that depends on them.
- Run the migration script in analysis mode first and keep the reports.
- Pilot in non-production, compare volumes, then migrate by region and subscription.
- Disable and delete NSG flow logs for migrated workloads to avoid double logging.
- Rewrite parsers to branch on
flowLogVersionand sum counts across tuples. - Move traffic analytics queries to
NTANetAnalyticsandNTAIpDetailsand set the 10-minute interval for detection workspaces. - Protect flow log storage: least privilege, no shared keys where possible, retention that matches your investigation window.
- Alert on flow log deletion, Network Watcher changes and gaps in expected records.
- Scope and review the managed identity used by the deploy policy remediation task.
- Document coverage gaps for unsupported PaaS services and FastPath and decide on compensating telemetry.
- Rehearse an investigation that uses raw flow logs to estimate blast radius and outbound volume.
Standards and references
- Microsoft Learn: Virtual network flow logs overview
- Microsoft Learn: Migrate NSG flow logs to virtual network flow logs
- Microsoft Learn: Manage virtual network flow logs using Azure Policy
- Microsoft Learn: Traffic analytics overview
- Microsoft Learn: Traffic analytics schema and data aggregation
- NIST: SP 800-53 Rev. 5 (SC-7 Boundary Protection, SI-4 System Monitoring, AU-6 Audit Record Review)
- NIST: SP 800-92 Rev. 1 Cybersecurity Log Management Planning Guide (initial public draft)
- MITRE D3FEND: Network Traffic Analysis
Related NHI Mgmt Group resources: Azure Virtual Network Security Guide · Microsoft Sentinel Guide · Azure Policy and Management Groups Guide · Microsoft Defender for Cloud Guide