Description
Use Virtual Network flow logs for new deployments. Azure stopped accepting new NSG flow logs on June 30, 2025. NSG collection ends on September 30, 2027. Existing records in Storage follow their retention policy.
Potential impact
A disabled flow log stops recording sources, destinations and allow/deny decisions on that path, which makes connectivity and policy problems harder to investigate. Packet contents require a separate capture.
Remediation
Configure flow logs for the required VNet and check the storage account, collection permissions, retention and cost. Generate known traffic and verify that new records arrive. Connect monitoring and alerts before retiring the old NSG collection.
Examples
Both excerpts use older AzureRM syntax and configure seven-day retention. Only the second collects new records, with enabled = true. Supply the name and referenced resources, then check storage access and retention.
Before
resource "azurerm_network_watcher_flow_log" "example" {
network_watcher_name = azurerm_network_watcher.test.name
resource_group_name = azurerm_resource_group.test.name
network_security_group_id = azurerm_network_security_group.test.id
storage_account_id = azurerm_storage_account.test.id
enabled = false
retention_policy {
enabled = true
days = 7
}
}
After
resource "azurerm_network_watcher_flow_log" "example" {
network_watcher_name = azurerm_network_watcher.test.name
resource_group_name = azurerm_resource_group.test.name
network_security_group_id = azurerm_network_security_group.test.id
storage_account_id = azurerm_storage_account.test.id
enabled = true
retention_policy {
enabled = true
days = 7
}
}