Recently had to install MS SQL on a Windows Server Core installation. No GUI to manage the firewall and I can't ever for the life of my remember the commands or ports used.
The command below can be used to open up the ports for all Firewall profiles in Windows:
New-NetFirewallRule -DisplayName "SQL Server" -Direction Inbound -Protocol TCP -LocalPort 1433 -Action allow -
New-NetFirewallRule -DisplayName "SQL Admin Connection" -Direction Inbound -Protocol TCP -LocalPort 1434 -Action allow
New-NetFirewallRule -DisplayName "SQL Database Management" -Direction Inbound -Protocol UDP -LocalPort 1434 -Action allow
New-NetFirewallRule -DisplayName "SQL Service Broker" -Direction Inbound -Protocol TCP -LocalPort 4022 -Action allow
New-NetFirewallRule -DisplayName "SQL Debugger/RPC" -Direction Inbound -Protocol TCP -LocalPort 135 -Action allow
New-NetFirewallRule -DisplayName "SQL Analysis Services" -Direction Inbound -Protocol TCP -LocalPort 2383 -Action allow
New-NetFirewallRule -DisplayName "SQL Browser" -Direction Inbound -Protocol TCP -LocalPort 2382 -Action allow
New-NetFirewallRule -DisplayName "HTTP" -Direction Inbound -Protocol TCP -LocalPort 80 -Action allow
New-NetFirewallRule -DisplayName "SSL" -Direction Inbound -Protocol TCP -LocalPort 443 -Action allow
New-NetFirewallRule -DisplayName "SQL Server Browse Service" -Direction Inbound -Protocol UDP -LocalPort 1433 -Action allowNew-NetFirewallRule -DisplayName "SQL Dynamic Ports" -Direction Inbound -Protocol TCP -LocalPort 61145 -Action allow
If you want it to only apply to the Domain profile, add -Profile Domain
after the -Action allow
The dynamic ports rule will need to be adjusted based on your own configuration, this rule allows remote access using SQL Management Studio.