Describe the bug
When calling ag_listener on an existing listener with state = present and matching port numbers, an error is thrown by Set-DbaAgListener
The listener with DNS name 'mylistener' for the availability group 'myAG' is already listening on the TCP port 1433. Please choose a different TCP port for the listener. If there is a problem with the listener, try restarting the listener to correct the problem.
Expected behavior
When calling ag_listener on an existing listener with state = present and matching port numbers, I expect no action to be taken.
Dbatools : 2.0.4
The issue is that Get-DbaAgListener uses the keyname PortNumber for the listener port while Set-DbaAgListener uses Port. The ag_listener module uses Port for both so the not equals comparison is always true.
Describe the bug When calling ag_listener on an existing listener with state = present and matching port numbers, an error is thrown by Set-DbaAgListener
The listener with DNS name 'mylistener' for the availability group 'myAG' is already listening on the TCP port 1433. Please choose a different TCP port for the listener. If there is a problem with the listener, try restarting the listener to correct the problem.
Expected behavior When calling ag_listener on an existing listener with state = present and matching port numbers, I expect no action to be taken.
Dbatools : 2.0.4
The issue is that
Get-DbaAgListener
uses the keynamePortNumber
for the listener port while Set-DbaAgListener usesPort
. The ag_listener module uses Port for both so the not equals comparison is always true.lowlydba/sqlserver/plugins/modules/ag_listener.ps1
should be