Pages

Tuesday, 31 January 2017

Connecting Server 2016 RDS Connection Broker to Azure Database fails with "the database specified in the database connection string is not available from the RD Connection Broker..."

When you try to configure a Windows Server 2016 Remote Desktop Services (RDS) Connection Broker to use an Azure PaaS database instance you get the following error;

"The database specified in the database connection string is not available from the RD Connection Broker server. Ensure that the database server is available on the network, the database exists and is empty (no scheme present), the Database server native client is installed on the RD Connection broker server, and the RD connection broker has write permissions to the database."


The error was caused by a firewall configuration on the Azure side, to alter the settings you must click the Firewall tab of the SQL Server (logical) in Azure, then enable the setting Allow access to Azure Services.


In addition to this click the Add Client IP option which will automatically populate an inbound firewall rule to allow incoming connections from the IP address you are currently accessing the portal via.


Click to Save the changes.


When you try to continue with the RDS installation the wizard will get past the error message. 


Windows Server 2016 RDS Connection Broker HA with Azure PaaS Databases using PowerShell

One of the most welcomed features in Windows Server 2016 when on the topic of Remote Desktop Services is the ability to store the RD Connection Broker state database in an Azure PaaS database instance. In previous versions of RDS, the only method to achieve high availability for the RD Connection Broker was to implement a shared SQL database using AlwaysOn Availability Groups or a similar HA technique inside SQL Server.



Connect to your Azure ARM account

Add-AzureRmAccount

Define the variable and create a new Resource Group

$resourceGroup = "rds2016"
$resourceGroupLocation = "West Europe"

New-AzureRmResourceGroup -Name $resourceGroup -Location $resourceGroupLocation

Define the variables for the SQL Server

$serverName = "rds2016demo"
$serverVersion = "12.0"
$serverLocation = $resourceGroupLocation
$serverResourceGroupName = $resourceGroup

$serverAdmin = "IT"
$serverAdminPassword = "pshere"
$securePassword = ConvertTo-SecureString -String $serverAdminPassword -AsPlainText -Force
$serverCreds = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $serverAdmin, $securePassword

Create the new logical SQL Server using defined variables

New-AzureRmSqlServer -ResourceGroupName $resourceGroup -ServerName $serverName -Location $serverLocation -ServerVersion $serverVersion -SqlAdministratorCredentials $serverCreds

Define the variables for the SQL database

$DatabaseName = "rdsdeployment"
$DatabaseEdition = "Basic"
$DatabaseServiceLevel = "Basic"

Create the new database using defined variables

$AzureDatabase = New-AzureRmSqlDatabase -DatabaseName $DatabaseName -ServerName $serverName -ResourceGroupName $resourceGroup -Edition $DatabaseEdition -RequestedServiceObjectiveName $DatabaseServiceLevel
$AzureDatabase


I used the portal to check that the resources had been created properly before I started configuring the Remote Desktop Connection Brokers. 


Now the Azure PaaS database has been created we can now configure our RD Connection Brokers to use it as the state database. Although you must first create some firewall rules on the Azure side to allow communication to your cloud SQL instance. Click the Firewall tab enable Allow access to Azure services and click the Add client IP


Commit the changes by clicking Save.

I have configured my deployment with two multi-role RDS servers, all the roles with the exception of the RD Connection Broker have already been made highly available.


From the Deployment Overview page, right click on the RD Connection Broker and select Configure High Availability.


Select Shared Database Server and click Next.


From your Azure PaaS database click on the Show database connection strings option.


Click the ODBC (Including Node.js) tab and copy the entire connection string. 


You then have to download and install the ODBC Driver 13 for SQL Server, you can grab a copy from here https://www.microsoft.com/en-us/download/details.aspx?id=53339

Once this has been done return to the RD configuration screen and enter the FQDN of the RDS cluster I have configured DNS Round Robin ahead of time for this deployment. Please note you could also use a hardware application delivery controller, this would be the recommended approach as DNS RR does not offer any kind of “failover”. I explain some of the differences in this blog post


You must copy the entire connection string, but please remember to change the password field. 



Saturday, 28 January 2017

Legacy deleted RDS Session Collections still appear in RD Web Access

When you delete RDS Session Collections from the Server Manager GUI you may find that they still appear when users login from RD Web Access. This is because the GUI tools do not properly remove the Session Collections from the RDS Servers registry.


The registry path for Session Collections is Local Machine\Software\Microsoft\Windows NT\CurrentVersion\Terminal Server\Central Published Resources\Published Farms you will see the legacy collections listed under here.


Simply delete these entries and restart the IIS role and when users log back into RD Web Access the old session collection will be gone.




Wednesday, 11 January 2017

How to find all the available Windows Server 2012 R2 images in Azure in Powershell (Service Manager)

The following command can be used to outline all the available Windows Server 2012 R2 images that are available to you when creating Azure VM's (Service Manager). 

( Get-AzureVMImage | where-object { $_.Label -like "Windows Server 2012 R2*" } )

You can of course change the label string if you are looking for something else. 

When the command returns the results it is the "ImageName" property that is required for commands such as New-AzureVMConfig.

In an example I needed to reference a Windows Server based image in order to spin up a new VM using Service Manager.

New-AzureVMConfig -Name vmhostname -InstanceSize Small -ImageName "a699494373c04fc0bc8f2bb1389d6106__Windows-Server-2012-R2-20161214-en.us-127GB.vhd"