Hey I got a simple HA/AG SQL 2017 on the latest CU14.
I am trying to copy users from the primary to the secondary and it all works well on port 1433.
I can enable/disable the firewall and the script works as expected.
The problem is that when the 1433 TCP Port is changed to another port, the script fails whenever the firewall is enabled on the intended destination. If I disable the FW, it just works.
So i tried open ports 5022, and 49000-51000, same fail, multiple reboots, applying SQLAgent and ..CEIP.. to the firewall allowed communitaction - all fails. Process monitor does not tell me what is blocked and reports the expected ports and applications are responding as intended and succeded.
In Powershell I used the same script, zero modifications.
My Script fails when it runs
Invoke-Sqlcmd -Query $Query -ServerInstance 10.10.15.204
The exact failure message is
Invoke-Sqlcmd : Connection Timeout Expired. The timeout period elapsed while attempting to consume the pre-login handshake acknowledgement. This could be because the pre-login handshake failed or the server was unable to respond back in time. The duration spent while attempting to connect to this server was - [Pre-Login] initialization=19286; handshake=16099;
At C:\scripts\powershell.ps1:344 char:17
+ ... Invoke-Sqlcmd -Query $Query -ServerInstance 10.10.15.204
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Invoke-Sqlcmd], SqlException
+ FullyQualifiedErrorId : SqlExectionError,Microsoft.SqlServer.Management.PowerShell.GetScriptCommand
Invoke-Sqlcmd :
At C:\scripts\powershell.ps1:344 char:17
+ ... Invoke-Sqlcmd -Query $Query -ServerInstance 10.10.15.204
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ParserError: (:) [Invoke-Sqlcmd], ParserException
+ FullyQualifiedErrorId : ExecutionFailureException,Microsoft.SqlServer.Management.PowerShell.GetScriptCommand
What Do I Do?