Information
Network security group flow logs should be enabled and the retention period set to greater than or equal to 90 days.
Retirement Notice
On September 30, 2027, network security group (NSG) flow logs will be retired. As of June 30, 2025, creating new NSG flow logs is no longer possible. Azure recommends migrating to virtual network flow logs. Review https://azure.microsoft.com/en-us/updates?id=Azure-NSG-flow-logs-Retirement for more information.
For virtual network flow logs, consider applying the recommendation Ensure that virtual network flow log retention days is set to greater than or equal to 90 in this section.
Flow logs enable capturing information about IP traffic flowing in and out of network security groups. Logs can be used to check for anomalies and give insight into suspected breaches.
Solution
Remediate from Azure Portal
- Go to Network Watcher.
- Under Logs, select Flow logs.
- Click the name of a network security group flow log.
- Set Status to On.
- Set Retention days to 0, 90, or a number greater than 90. If Retention days is set to 0, the logs are retained indefinitely with no retention policy.
- Click Save.
- Repeat steps 1-6 for each network security flow log requiring remediation.
Remediate from Azure CLI
For each network security group flow log requiring remediation, run the following command to enable the flow log and set retention to 0, 90, or a number greater than 90:
az network watcher flow-log configure --nsg <network-security-group> --enabled true --resource-group <resource-group> --retention <number-of-days> --storage-account <storage-account>
Impact:
This will keep IP traffic logs for 90 days or longer. As a level 2, first determine your need to retain data, then apply your selection here. As this is data stored for a longer period, your monthly storage costs will increase depending on your data use.