diff --git a/docs/reference/resources/Microsoft/Windows/FirewallRuleList/examples/configure-firewall-rules.md b/docs/reference/resources/Microsoft/Windows/FirewallRuleList/examples/configure-firewall-rules.md new file mode 100644 index 000000000..0f552ab12 --- /dev/null +++ b/docs/reference/resources/Microsoft/Windows/FirewallRuleList/examples/configure-firewall-rules.md @@ -0,0 +1,279 @@ +--- +description: > + Example showing how to use the Microsoft.Windows/FirewallRuleList resource in a DSC configuration + document to create and enforce Windows Firewall rules. +ms.date: 05/09/2026 +ms.topic: reference +title: Configure firewall rules +--- + +# Configure firewall rules + +This example shows how you can use the `Microsoft.Windows/FirewallRuleList` resource in a DSC +configuration document to create and enforce multiple Windows Firewall rules in a single operation. + +> [!IMPORTANT] +> **Set** operations for this resource require an elevated (administrator) process context. Run +> your terminal or PowerShell session as Administrator before using `dsc config set`. + +## Definition + +The configuration document for this example defines one instance of the `FirewallRuleList` +resource that manages two rules: + +- **DscDemo - Custom App (TCP-In)** — allows inbound TCP traffic on port 8080 for a custom + application, active on the Domain and Private profiles. +- **DscDemo - Block Telnet (TCP-Out)** — blocks all outbound TCP connections to port 23 (Telnet) + on all profiles. + +:::code language="yaml" source="firewall.config.dsc.yaml"::: + +Copy the configuration document and save it as `firewall.config.dsc.yaml`. + +## Test the configuration + +To see whether the rules already exist, use the [dsc config test][01] command. + +```powershell +dsc config test --file ./firewall.config.dsc.yaml +``` + +Because neither rule exists yet, both appear in the actual state with `_exist: false`. DSC +computes the instance as out of desired state and lists `rules` in `differingProperties`. + +```yaml +executionInformation: + duration: