When using VCF Operations for Networks to identify a large volume of inactive firewall rules (e.g., zero hit counts over 30 days), manual deletion through the NSX Manager UI is time-consuming and prone to human error. Use the NSX Policy API to remove these unused policies programmatically.
VCF Operations for Networks 6.13.x
VCF Operations for Networks 6.14.x
NSX 4.x
For a large dataset of unused rules, use the NSX Policy API to perform deletions. Sequential processing is required to avoid API conflicts.
nsx firewall rule where flow is not set.Warning: This command makes changes to your system. Review the targeted Rule IDs carefully before execution.
DELETE https://<nsx-manager-ip>/policy/api/v1/infra/domains/<domain-id>/security-policies/<policy-id>/rules/<rule-id>
<domain-id> is typically default. In multi-tenant architectures, replace this with the specific Domain ID.DELETE API as the UI (which uses PATCH) will fail with Error code 500157 .