Joining the secondary replicas to Availability Group

In this recipe, we will join the secondary replicas to an existing Availability Group.

Getting ready

Before we proceed with this recipe, the availability group needs to be created. Let's take a look at the Creating an AlwaysOn Availability Group recipe.

As documented on MSDN, the prerequisites to join the secondary replicas are as follows:

  • The primary replica should be online
  • The join command to join the secondary replicas to the availability group needs to take place at the secondary server instance that hosts the secondary replicas
  • The secondary instance must be able to connect to the database mirroring endpoint of the primary instance

Since we need to execute the command on the secondary instances, ...

Get SQL Server 2014 with PowerShell v5 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.