SfB Server: 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

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. (…)”

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:

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

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 *
Robocopy – Info

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…:

In the first step, we click Next:

We select the two databases (xds and lis):

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

Then we need to connect to the other SQL node:

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

And then the Wizard will perform a validation check:

In the Summary, we click Finish:

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

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

Step 3  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://docs.microsoft.com/powershell/module/skype/Export-CsConfiguration

Export-CsLisConfiguration
https://docs.microsoft.com/powershell/module/skype/Export-CsLisConfiguration

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

Move-CsManagementServer
https://docs.microsoft.com/powershell/module/skype/Move-CsManagementServer

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.