Back to controls

Ensure Network Security Group Flow Log retention period is 'greater than 90 days'

Network Security Group Flow Logs should be enabled and the retention period is set to greater than or equal to 90 days.

Category

Controls

Low

Applies to

Microsoft Azure

Coverage

1 queries

Asset types

1 covered

Overview

Network Security Group Flow Logs should be enabled and the retention period is set to greater than or equal to 90 days.

Rationale

Flow logs enable the capture of 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.

Impact

This will keep IP traffic logs for longer than 90 days. As a level 2, determine your need to retain data and apply your selection here. As this is data stored for longer, your monthly storage costs will increase depending on your data use.

Default Value

By default, Network Security Group Flow Logs are disabled.

References

  1. https://learn.microsoft.com/en-us/azure/network-watcher/network-watcher-nsg-flow-logging-overview
  2. https://learn.microsoft.com/en-us/cli/azure/network/watcher/flow-log?view=azure-cli-latest
  3. https://learn.microsoft.com/en-us/azure/security/benchmarks/security-controls-v2-logging-threat-detection#lt-6-configure-log-storage-retention

Remediation guidance

Remediate from Azure Portal

  1. Go to Network Watcher
  2. Select the NSG flow logs blade in the Logs section
  3. Select each Network Security Group from the list
  4. Ensure Status is set to On
  5. Set Retention (days) to 90 or greater.
  6. Select your storage account in the Storage account field
  7. Select Save

Remediate from Azure CLI

Enable the NSG flow logs and set the Retention (days) to greater than or equal to 90 days.

az network watcher flow-log configure --nsg <nsgNameOrID> --enabled true --resource-group <resourceGroupName> --retention 90 --storage-account <storageAccountNameOrID>

Service-wide remediation

Recommended when many resources are affected: fix the platform baseline first so new resources inherit the secure setting, then remediate the existing flagged resources in batches.

Azure

Use management group or subscription Azure Policy assignments, remediation tasks where supported, landing-zone standards, and IaC modules so drift is prevented at scale.

Operational rollout

  1. Fix the baseline first at the account, subscription, project, cluster, or tenant scope that owns this control.
  2. Remediate the currently affected resources in batches, starting with internet-exposed and production assets.
  3. Re-scan and track approved exceptions with an owner and expiry date.

Query logic

These are the stored checks tied to this control.

Azure NSG Flow Logs with retention shorter than 90 days

Connectors

Microsoft Azure

Covered asset types

FlowLog

Expected check: eq []

{
  flowLogs(
    where: {
      targetResourceID_CONTAINS: "networkSecurityGroups"
      retentionPolicyDays_LT: 90
    }
  ) {
    ...AssetFragment
  }
}
Cyscale Logo
Cyscale is an agentless cloud-native application protection platform (CNAPP) that automates the contextual analysis of cloud misconfigurations, vulnerabilities, access, and data, to provide an accurate and actionable assessment of risk.

Stay connected

Receive new blog posts and product updates from Cyscale

By clicking Subscribe, I agree to Cyscale’s Privacy Policy


© 2026 Cyscale Limited

LinkedIn icon
Twitter icon
Facebook icon
crunch base icon
angel icon