SfB Server 2015: Moving Central Management to a pool with SQL Server AlwaysOn BackEnd

In a previous post, we described how to configure AlwaysOn Availability Groups for Skype for Business Server 2015:

Deploying SQL Server AlwaysOn Availability Group for Skype for Business Server 2015
https://blogs.technet.microsoft.com/uclobby/2015/05/08/deploying-sql-server-alwayson-availability-group-for-skype-for-business-server-2015/

That same post covers a green field deployment, but in this one we are going to work on a scenario where the xds and lis aren’t initially added to the AlwaysOn Availability Group.

Step 1  Install the Database on one of the SQL nodes

First, we need to check the active node in the AlwaysOn Availability Group, as we should use the SQL node FQDN instead of the SQL pool FQDN. If we try to use the SQL pool FQDN, we get this error:

“Install-CsDatabase : An error occurred while creating or updating the database for feature CentralMgmtStore. (…)”

CMS-AlwaysOn-00a

As we can see, the Install-CsDatabase cmdlet is trying to use the \\sqlpool.borderlands.lab\C$. However, since this is the listener FQDN, it doesn’t connect to the SQL node file share and the cmdlet fails.

To check the active node we can use the SQL Server Management Studio. Connect to one of the SQL nodes and then expand AlwaysOn High Availability > Availability Groups > Group Name > Availability Replicas:

CMS-AlwaysOn-00b

In this case, the SQL01 is the primary. Now we go back to the Skype for Business Server PowerShell and we can install the Central Management Database:

Install-CsDatabase -CentralManagementDatabase -SqlServerFqdn sql01.borderlands.lab -SqlInstanceName S4B_BE

CMS-AlwaysOn-04

Step 2  Add the CMS databases to the AlwaysOn Availability Group

Before adding the database to the AlwaysOn Availability Group, we need to change the database recovery to full and also perform a full backup. This can be achieved by running the following PowerShell cmdlets on the SQL01 PowerShell:

Invoke-Sqlcmd -Query “ALTER DATABASE [xds] SET RECOVERY FULL WITH NO_WAIT;” -ServerInstance “SQL01\S4B_BE”
Invoke-Sqlcmd -Query “ALTER DATABASE [lis] SET RECOVERY FULL WITH NO_WAIT;” -ServerInstance “SQL01\S4B_BE”

Backup-SqlDatabase -ServerInstance SQL01\S4B_BE -Database xds
Backup-SqlDatabase -ServerInstance SQL01\S4B_BE -Database lis

We should also copy the directory structure to the second SQL node:

robocopy C:\CsData \\SQL02\C$\CsData /e /xf *
https://technet.microsoft.com/en-GB/library/cc733145.aspx

CMS-AlwaysOn-00c

Now everything is ready to add xds and lis to the existing AlwaysOn Availability Group. To do this we need to right click on the Availability Group and select Add Database…:

CMS-AlwaysOn-05

In the first step, we click Next:

CMS-AlwaysOn-06

We select the two databases (xds and lis):

CMS-AlwaysOn-07

We will need a temp file share for the initial sync:

CMS-AlwaysOn-08

Then we need to connect to the other SQL node:

CMS-AlwaysOn-09

If successful connected, the Connected As should change to the user that we use:

CMS-AlwaysOn-10

And then the Wizard will perform a validation check:

CMS-AlwaysOn-11

In the Summary, we click Finish:

CMS-AlwaysOn-12

Now the Wizard will execute the tasks to add the databases to the Availability Group:

CMS-AlwaysOn-13

After the Wizard finishes, the databases are shown as part of the Availability Group:

CMS-AlwaysOn-14

Step 4  Move the Central Management Store

This will be the normal procedure to move the CMS. Before moving, it’s recommended to perform a backup:

Export-CsConfiguration
https://technet.microsoft.com/en-us/library/gg398627.aspx

Export-CsLisConfiguration
https://technet.microsoft.com/en-us/library/gg398539.aspx

Next, in one of the Skype for Business Server pool Front End run:

Move-CsManagementServer

CMS-AlwaysOn-16

If the move is successful, we need to run Deployment Wizard > Step 2 on the remaining pool front ends and then start the newly added services: Master Replicator Agent and File Transfer Agent.

Finally, we should also run Deployment Wizard > Step 2 on the servers that previously had the Central Management role.