Skip to content

Windows Defender Firewall with Advanced Security: Scoped Inbound Rules

Admin
October 4, 2026
8 min read
Intermediate
πŸ’» Target OS: Windows Server 2025 / 2022

Before you begin

  • Applies to:Windows with Defender Firewall with Advanced Security. This walkthrough uses the local console where local policy controls the rule.
  • Where to start:On the host running the service, open the firewall console as a local administrator. Use two separate clients to verify the rule.
  • What you need:Record the service executable, listening host and port, approved subnet, and active profile. Have one test client inside the allowed subnet and one outside it.
Guide tools
Guide tools
0/0 Steps (0%)

Windows Defender Firewall with Advanced Security (WFAS) manages Windows Defender Firewall rules through the wf.msc Microsoft Management Console snap-in. This walkthrough creates a custom inbound rule for a service listening on TCP port 8443, limited to an approved management subnet and the Domain profile.

Replace the port, executable path, and subnet with the values approved for your service. On domain-managed systems, create or edit the rule in the controlling Group Policy Object (GPO); a local rule can be overridden by policy. The MMC requires administrator rights to change local firewall policy.


01

Launch the Firewall MMC Snap-in

Console

Where to click

  1. Press Windows+R, type wf.msc, then press Enter. Approve the administrator prompt if one appears.
  2. In the left pane, confirm that the root is Windows Defender Firewall with Advanced Security on Local Computer. If you opened a Group Policy editor, open wf.msc directly before continuing.
  3. Select Inbound Rules in the left pane.

What to look for Β· Review the existing rules for the application or port before adding another one.

Win + R
wf.msc
❯ Illustrative Output (Results Vary)
Console tree:
Windows Defender Firewall with Advanced Security
Inbound Rules
Outbound Rules
Connection Security Rules
Monitoring
Windows Defender Firewall with Advanced Security MMC showing the Inbound Rules list and Actions pane

Figure 1: Windows Defender Firewall with Advanced Security (wf.msc) showing the active Inbound Rules table, profiles, and the Actions pane.


02

Choose Custom to Expose the Full Wizard

Rule Type

With Inbound Rules selected, choose Action β†’ New Rule. On the Rule Type page, choose Custom. The Port option is shorter, but Custom exposes the Program and Scope pages so the rule can be limited to the service executable and approved sources.

Inbound Rules β†’ Action β†’ New Rule β†’ Custom β†’ Next
❯ Illustrative Output (Results Vary)
Program page:
This program path: <full path to the service executable>
Select Next. Use the specific executable when the service has a dedicated program.

03

Allow TCP 8443 for the Service

Protocol and Ports

On Protocol and Ports, choose TCP and Specific local ports, then enter 8443. For inbound TCP/UDP rules, this page configures the local listening port. The remote client source port is not configured here and is normally dynamic.

Protocol type: TCP
Local port: Specific local ports β†’ 8443
❯ Illustrative Output (Results Vary)
The rule matches TCP connections addressed to local port 8443.
New Inbound Rule Wizard Protocol and Ports page with TCP selected and local port 8443 specified

Figure 2: New Inbound Rule Wizard on the Protocol and Ports page selecting TCP protocol and specifying local destination port 8443.


04

Limit Remote Addresses to Approved Clients

Scope

On Scope, leave local addresses as Any IP address unless this server listens on multiple networks and the service should be reachable only on a specific interface address. Under remote addresses, choose These IP addresses and add the approved management subnet. For this walkthrough, enter 10.20.30.0/24; replace it with the source subnet from your network plan.

Which local IP addresses does this rule apply to?
Any IP address
Which remote IP addresses does this rule apply to?
These IP addresses: 10.20.30.0/24
❯ Illustrative Output (Results Vary)
Only clients whose source address is in 10.20.30.0/24 match this rule.
New Inbound Rule Wizard Scope page with remote management subnet 10.20.30.0/24 configured

Figure 3: New Inbound Rule Wizard on the Scope page with the modal dialog adding remote management subnet 10.20.30.0/24.


05

Allow Only the Intended Service Traffic

Policy

Select Allow the connection only if this traffic is required and the service is protected by its own authentication and authorization controls. Apply the rule to Domain only when the host is domain joined and the service should accept traffic only on that network profile. Finish with a unique name and description so another administrator can identify its purpose and owner.

Action: Allow the connection
Profile: Domain
Name: Admin Portal - TCP 8443 - Management Subnet
Description: Inbound access to the admin portal from 10.20.30.0/24.
❯ Illustrative Output (Results Vary)
Rule created with a narrow program, port, source subnet, and profile scope.

06

Inspect the Effective Rule and Test Reachability

Verification

Confirm the rule is enabled with the intended direction, action, profile, local port, and remote address. Test from a client inside the approved subnet, then verify a client outside that scope is not granted access by this rule. Other broader allow rules can independently permit traffic, so evaluate the complete effective policy when validating the negative test.

What you should see Β· Test from an approved client and a client outside the allowed subnet. Expect TcpTestSucceeded to be True on the approved client and False outside the scope.

If you see something else Β· If both tests fail, confirm the service is listening and the Domain profile is active. If both succeed, check for an overlapping allow rule or an unexpected source address. For immediate rollback, return to Inbound Rules, right-click the exact rule created in Step 5, and select Disable Rule.

Terminal window
$Rule = Get-NetFirewallRule -DisplayName 'Admin Portal - TCP 8443 - Management Subnet'
$Rule | Select-Object DisplayName, Enabled, Profile, Direction, Action
$Rule | Get-NetFirewallPortFilter | Select-Object Protocol, LocalPort
$Rule | Get-NetFirewallAddressFilter | Select-Object LocalAddress, RemoteAddress
# Run separately on each test client. Use the service DNS name and port.
$Target = "admin-portal.contoso.com"
$Port = 8443
Test-NetConnection -ComputerName $Target -Port $Port
❯ Illustrative Output (Results Vary)
Enabled : True
Profile : Domain
Direction : Inbound
Action : Allow
Protocol : TCP
LocalPort : 8443
RemoteAddress : 10.20.30.0/24
TcpTestSucceeded : True

For the supported wizard workflow, see Microsoft’s Configure firewall rules with Group Policy. For rule details and scoping guidance, see Windows Firewall rule authoring.

Comments