Hi,
I am attempting to create a always on AG using PowerShell, however when I issue the command:
Add-SqlAvailabilityDatabase -Path "SQLSERVER:\SQL\TEST2\MSSQLDB\AvailabilityGroups\peter" -Database "peter"
It fails with the the error message below. The same error appears when I use management studio but is successfully when I select the full option instead of the join only radio button on the GUI.
My question is, how do I replaicate the full operation using powershell i.e. is it an "Add-SqlAvailabilityDatabase" command ? What is the synatx ?
Thanks in advance,
**********************************
Add-SqlAvailabilityDatabase : The connection to the primary replica is not active. The command cannot be processed.
At line:1 char:28
+ Add-SqlAvailabilityDatabase <<<< -Path "SQLSERVER:\SQL\TEST2\MSSQLDB\AvailabilityGroups\peter" -Database "peter"
+ CategoryInfo : InvalidOperation: (:) [Add-SqlAvailabilityDatabase], SqlException
+ FullyQualifiedErrorId : ExecutionFailed,Microsoft.SqlServer.Management.PowerShell.Hadr.AddSqlAvailabilityGroupDa
tabaseCommand
**********************************