DBATools: Invoke-DbaDbMirroring - prompting for credentials

I have been regularly using a Powershell script I wrote some time ago that sets up database mirroring and it works fine but I am interested to try out the Invoke-DbaDbMirroring cmdlet. However, the problem is that it prompts for the password for the mirroring Logins even though I haven’t specified the PrimarySqlCredential or MirrorSqlCredential params.

This is on a pair of servers on which mirroring has already been setup and the Endpoints have been created, etc. In my existing powershell script that does not use Invoke-DbaDbMirroring, all it does to start database mirroring after the usual db and log backup and restores is to issue the ALTER DATABASE [myDB] SET PARTNER = ‘TCP:…’ command and it works. Same if I do it all manually via T-SQL. I never have to be concerned with the passwords for the SQL Login on Primary or Mirror.

$PrimaryServer = “SQL01”
$MirrorServer = “SQL02”
$dbName = “MyDB”

Invoke-DbaDbMirroring -Primary $PrimaryServer -Mirror $MirrorServer -Database $dbName -SharedPath “\$MirrorServer\BackupsForMirroring” -Confirm:$false

Any ideas what the issue is? I don’t believe I should be prompted for the passwords.

thanks in advance.


Some more info… The password prompts twice. It just states on the ‘Windows PowerShell ISE - Input’ dialogue, 'Enter a new password for the SQL Server Login(s).

It doesn’t say anything about what the Login name it thinks it is. I can enter any new passwords and the process completes - mirroring for the specified databse is setup successfully. If I manually stop database mirroring for the same database and re-run Invoke-dbaDbMirroring again, it just prompts for two new passwords again.