Skip to content

Add-DbaAgListener - Stop demanding databases the command does not know - #10612

Open
andreasjordan wants to merge 1 commit into
developmentfrom
fix-adddbaaglistener-error-message
Open

Add-DbaAgListener - Stop demanding databases the command does not know#10612
andreasjordan wants to merge 1 commit into
developmentfrom
fix-adddbaaglistener-error-message

Conversation

@andreasjordan

Copy link
Copy Markdown
Collaborator

Problem

When Add-DbaAgListener is called with -SqlInstance but without -AvailabilityGroup, it stops with:

You must specify one or more databases and one or more Availability Groups when using the SqlInstance parameter.

The command has no -Database parameter at all — the wording was copy-pasted from the availability group database commands. A user who follows the message literally is told to supply a parameter that does not exist.

What changed

The message now matches what the check at that line actually requires:

You must specify one or more Availability Groups when using the SqlInstance parameter.

One line; no behavior change. No test asserts the old wording, so no test changes are needed. The existing test file passes against the lab HADR instance (3/3).

Sibling wording fixes for Remove-DbaAgDatabase and Remove-DbaAgListener ride along in #10608 and #10609; Set-DbaAgListener has the same message shape but its text matches its check, so it is untouched.

🤖 Generated with Claude Code

The error text for a missing -AvailabilityGroup told the user to
specify "one or more databases and one or more Availability Groups",
but the command has no Database parameter at all. The wording was
copy-pasted from the availability group database commands.

(do Add-DbaAgListener)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant