Skip to content

Implement canonical _purge on Microsoft.Windows/FirewallRuleList for authoritative rule management #1579

@boaz-raz

Description

@boaz-raz

Summary of the new feature / enhancement

The Microsoft.Windows/FirewallRuleList resource (v0.1.0) supports per-rule _exist: false to remove named rules, but has no way to make the declared rules list authoritative — i.e., remove/disable rules that aren't declared (drift).

The canonical resource-level _purge property (semantics settled in #790) is the natural fit, but FirewallRuleList doesn't implement it. Inspecting the resource schema on dsc 3.2.1 and 3.2.2 shows no _purge (and additionalProperties: false), and the 3.3.0-preview.2 changelog adds --what-if/docs/elevation fixes but not _purge.

Use case

We're replacing legacy netsh advfirewall reset-style enforcement with DSC across ~1,500 Windows servers. We need each host's local inbound firewall to equal exactly the declared rules (Puppet-style purge of drift).

Today we work around this with a Microsoft.DSC.Transitional/PowerShellScript resource that enumerates Get-NetFirewallRule -PolicyStore PersistentStore and disables anything not in a hand-maintained allowlist. That allowlist is fragile (must be kept in sync with the declared rules by hand) and doesn't scale well. _exist: false doesn't help here because it requires knowing each undeclared rule's name in advance — drift is precisely the unknown case.

Proposed technical implementation details (optional)

Implement resource-level _purge: true on Microsoft.Windows/FirewallRuleList so the declared rules array is treated as the complete/authoritative set, consistent with the canonical _purge semantics agreed in #790.

Two questions on the intended behavior:

  1. Disable vs. delete — would _purge delete undeclared rules, or could it support disabling them? We rely on disable (reversible, avoids churn on OS-regenerated built-in rules) rather than deletion.
  2. Policy store scope — which store would _purge operate on? It's important that GPO-delivered rules can be excluded, so management-plane access (WinRM/RDP, delivered via GPO in a separate store) is never at risk.

Refs: #790 (canonical _purge semantics).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions