In the previous blogs I’ve explained you

This blog is a guide for configuring Citrix XenMobile with a multi-subnet SQL AlwaysOn database. When using a multi-subnet SQL AlwaysOn cluster, we need to reconfigure the Windows Failover Cluster Network parameters RegisterAllProvidersIP=0 and HostRecordTTL=60 for the XenMobile AlwaysOn listener. Special thanks for the details delivered by @JanPaulPlaisier! Details will be explained later in this blog.

During a customer’s project we’ve build the following XenMobile backend:

  • One XenMobile cluster
    • One XenMobile server in Amersfoort: PBO-XMS01.pbo.lan
    • One XenMobile server in Nijkerk: PBO-XMS02.pbo.lan
  • Both sites have a NetScaler with a GSLB configuration for XenMobile. The NetScaler configuration is not covered in this blog.

  • The XenMobile service in Amersfoort is the primary site. When the XenMobile service in Amersfoort becomes unresponsive, GSLB will failover the XenMobile services to Nijkerk.

Logical overview

Note: Site-to-site network latency is 4ms.

Create SQL Login for XenMobile service account

Create an Active Directory Service Account for the XenMobile database connection as follows:

1.    Create a Domain User in Active Directory, this is your service account (i.e. XMSvc)

2.    Open SQL Management Studio

3.    Create a SQL Server login for the XenMobile service account on all the SQL nodes in your AlwaysOn configuration. Starting with node 1:

4.    Select Windows Authentication and select your Service Account (i.e. PBO\XMSvc). Then click Server Roles:

5.    Select dbcreator and click OK:

6.    Create this login on the remaining SQL servers:

Creating the initial database

Before we can join the Citrix XenMobile database to a (Basic) Availability Group, we need to create the database on one of the SQL servers directly using the XenMobile appliance. This how-to is describing an initial setup using the XenMobile appliance. If you need to move an existing XenMobile database to an availability group, please skip this chapter and start with the next chapter.

1.    Import the XenMobile appliance you’ve downloaded from

2.    The “First time Use mode” is started, I will not discuss default configuration. I will only discuss database configuration

3.    Configure the database connection to connect to one of your SQL nodes directly (i.e. PBO-SQL01.pbo.lan). Connect using the XenMobile service account (i.e. PBO\XMSvc)

4.    The database is created by the “First Time Use mode

5.    Finish the “First Time Use mode” configuration with the specific options for your XenMobile design.

Joining the Citrix XenMobile database to a (Basic) AlwaysOn Availability Group

At this point, we want to join the “CTX-XM” database to a new Microsoft SQL multi-subnet Basic AlwaysOn Availability Group (BAG). When you have a Citrix XenMobile environment running without BAG, you can also use these steps to move to a BAG setup.

1.    Open SQL Management Studio

2.    Right click the CTX-XM database and click Properties

3.    Click Options and ensure Recovery model is Full. Click OK

4.    Right click CTX-XM and click Tasks –> Back Up..

5.    Create a Full backup of the CTX-XM database:

6.    Right click Availability Groups and click New Availability Group Wizard…

7.    Click Next

8.    Enter a name for the Availability Group (i.e. BAG-CTX-XM) and click Next

9.    Select the CTX-XM database and click Next

10.    Click Add Replica…

11.    Login to the second SQL node:

12.    Select Automatic Failover and ensure Availability Mode is Synchronous commit. Click Listener tab:

13.    Configure DNS-name and static IPs for the SQL AlwaysOn listener, click Next:

14.    Use a SMB share for initial seeding, click next:

15.    Availability Group validation. Click Next

16.    Verify Summary and click Finish

17.    Creating the AlwaysOn Availability group

18.    When everything is OK. Click Close:

19.    The availability group is created:

Reconfigure Windows Failover Cluster network parameters for BAG-CTX-XM Availability group

As I’ve mentioned in the Citrix XenApp/XenDesktop multi-subnet AlwaysOn blog, Windows Failover Cluster is creating a round-robin DNS A-record for the multi-subnet Availability group. This is also the default after creating a multi-subnet Availability group for XenMobile:

Since XenMobile is supporting (Basic) Availability groups

The SQL driver in the XenMobile appliance isn’t aware or configurable with the MultiSubnetFailover=true for the SQL connection string. Due to this, the XenMobile appliance will resolve the IP-addresses of the BAG with a round robin mechanism. Result: connection issues to the XenMobile database when the off-line IP off the SQL listener is resolved. Other Citrix products like Provisioning Services, XenApp or XenDesktop are configurable with the MultiSubnetFailover=true connection string.
To fix this issue for XenMobile, we can reconfigure the network parameters for the AlwaysOn XenMobile Availability group listener to only register the on-line IP to the DNS A-record. To force a recheck of the operating system, we reconfigure the network parameters to register a short TTL to the DNS record. This will force the XenMobile appliance to check if the IP is changed on the DNS every minute.

Reconfigure the network parameters for the SQL AlwaysOn XenMobile listener as follows:

1.    Login to one SQL nodes of the Windows Failover Cluster (i.e. PBO-SQL01)

2.    Start Powershell elevated

3.    Type Import-Module FailoverClusters to import the powershell modules:

4.    Type Get-ClusterResource and find the Cluster Resource Network Name for your XenMobile BAG. In this example BAG-CTX-XM_BAG-CTX-XM

5.    Reconfigure Cluster parameters as follows (replace BAG-CTX-XM_BAG-CTX-XM with the name of your WFC configuration):

Import-Module FailoverClusters 

Get-ClusterResource BAG-CTX-XM_BAG-CTX-XM | Set-ClusterParameter RegisterAllProvidersIP 0  

Get-ClusterResource BAG-CTX-XM_BAG-CTX-XM |Set-ClusterParameter HostRecordTTL 60 

Stop-ClusterResource BAG-CTX-XM_BAG-CTX-XM

Start-ClusterResource BAG-CTX-XM_BAG-CTX-XM

Then wait or force DNS replication to all your DNS-servers. After that flush DNS information on all the WFC nodes of the SQL AlwaysOn cluster and the XenMobile appliances.

6.    You will now have only one A-record with the active IP for the BAG:

7.    And after a failover to the other SQL server in the other subnet:

8.    The DNS record is adjusted:

As described in this blog I have a DNS-server PBO-DC01 in Amersfoort and a PBO-DC02 in Nijkerk. It is important that the XenMobile appliance (PBO-XM01) and SQL Server (PBO-SQL01) are using the DNS-server (PBO-DC01) as primary DNS-server in Amersfoort. For the Nijkerk site it is important that the XenMobile Appliance (PBO-XM02) and SQL Server (PBO-SQL02) are using DNS-server (PBO-DC02) as the primary DNS-server. The Windows Failover Cluster will contact the primary DNS-server to reconfigure the DNS-records in case of a failover. So if SQL and XenMobile appliances are configured the same way as WFC/SQL, XenMobile will notice the A-record change within 1 minute since it is contacting the same primary DNS-server.

Reconfigure Citrix XenMobile to use the multi-subnet Basic Availability Group

You can reconfigure XenMobile as follows:

1.    Login to the console of your XenMobile appliance and select 0 (Configuration) from the menu:

2.    Select option 3 (Database) from the menu:

3.    Reconfigure the server property to connect to the BAG FQDN:

4.    Reboot the appliance:

5.    Rebooting

6.    XenMobile is now reconfigured using the BAG: