Description
For existing network security group (NSG) flow logs, enabled controls collection and retentionPolicy controls when stored records expire.
Potential impact
If records expire too soon, investigators may be unable to identify which systems communicated during an incident or assess its reach.
Remediation
Match storage deletion policies to the period your investigations and audits require. Azure no longer accepts new NSG flow logs. Migrate existing configurations to virtual network flow logs before September 30, 2027, then check recent arrivals and the oldest records available at the destination.
Examples
The excerpts omit the Network Watcher, target resource and storage configuration. Automatic retention for existing NSG flow logs requires a general-purpose v2 storage account.
Before
resource flowLog 'Microsoft.Network/networkWatchers/flowLogs@2020-11-01' = {
name: 'networkWatcher/flowlog'
location: resourceGroup().location
properties: {
enabled: true
retentionPolicy: {
enabled: false
days: 2
}
}
}
Collection is on, but the retention policy is off, so days: 2 has no effect.
After
resource flowLog 'Microsoft.Network/networkWatchers/flowLogs@2020-11-01' = {
name: 'networkWatcher/flowlog'
location: resourceGroup().location
properties: {
enabled: true
retentionPolicy: {
enabled: true
days: 90
}
}
}
The policy is enabled with an example period of 90 days.