Remediation
Migrate Network Security Group (NSG) Flow Logs to Virtual Network Flow Logs
Azure Network Security Group (NSG) flow logs must be migrated to Azure Virtual Network flow logs. This process disables existing NSG flow logs and creates equivalent virtual network flow logs.
Generate Migration Files
- In the Azure portal, navigate to Network Watcher.
- Under Logs, select Migrate flow logs.
- Select the subscriptions and regions containing the NSG flow logs to migrate.
- Select Download script and JSON file.
A ZIP file named MigrateFlowLogs.zip is downloaded.
Run the Migration Script
-
Extract
MigrateFlowLogs.ziplocally. The archive contains:MigrationFromNsgToAzureFlowLogging.ps1RegionSubscriptionConfig.json
-
Run the migration script:
.\MigrationFromNsgToAzureFlowLogging.ps1 -
Select Run analysis by entering
1. -
When prompted, provide the path to the configuration file:
.\RegionSubscriptionConfig.json -
Enter the number of threads to use, or press Enter to accept the default value (
16).
Review Analysis Results
After the analysis completes:
-
A summary is displayed in the console.
-
A detailed HTML report is generated in the same directory:
AnalysisReport-{{subscriptionId}}-{{region}}-{{timestamp}}.html
The report identifies:
- NSG flow logs that will be disabled
- Virtual network flow logs that will be created
- The impact of migration with aggregation or without aggregation
Perform the Migration
-
Choose one of the following options:
2– Proceed with migration with aggregation3– Proceed with migration without aggregation
-
Review the migration summary.
-
Confirm the migration when prompted:
Do you want to rollback? You won't get the option to revert the actions done now again (y/n): n
Warning Once the migration proceeds, the changes cannot be reverted.
Validation
After the migration completes:
- Confirm that the original NSG flow logs are disabled
- Confirm that new Virtual Network flow logs have been created and are enabled
- Validate storage accounts, retention, and traffic analytics settings as required
Optional Cleanup
After successful validation:
- In Network Watcher, filter NSG flow logs by the migrated subscriptions and regions.
- Select the migrated NSG flow logs.
- Delete the flow logs to complete cleanup.