[Azure Stack] Deploy the SQL Server resource provider

February 11, 2016 at 6:00 am in Azure Stack, Resource Provider, TP1 by Florent

After the first article on how to deploy the MySQL RP of Azure Stack, I will explain to you how to install the SQL Server RP. Before starting, be sure to have to have a Windows Server 2012 R2 Datacenter image with the framework 3.5 (prerequisite for SQL Server) and the IE Enhanced Security Configuration disabled. To start, connect to the ClientVM and disable the IE Enhanced Security Configuration for the Administrator and User. It’s necessary to be able to authenticate on Azure AD without any problem:

image

On the ClientVM, install the last version of Azure PowerShell (version 1.2.1), that you can find here:

image

It’s now time to create a wildcard certificate to authorize the communication between your Resource Provider and your Azure Resource Manager. Connect to the PortalVM and open the IIS Console:

image

Here, navigate to PORTALVM > Server Certificates and click on Create Domain Certificate. Give to the common name the value *.azurestack.local. Give the same name for the friendly name. Other parameters can be fill in by you:

image

image

We will export the certificate. Open an MMC and connect to the local computer. In the Personal store, you will have you wildcard certificate:

image

Export this certificate with the private key:

image

Choose the extensions Export all extended properties and Include all instances in the certificate path if possible:

image

Give a password to protect the certificate:

image

Choose where to store the certificate:

image

Copy this certificate to \\SOFS\Share\Certificates\Wildcard :

image

Go back to your ClientVM and download the SQL Resource provider with this link and extract it. Rename the file AzureStack.SqlRP.Deployment.*.nupkg to AzureStack.SqlRP.Deployment.*.zip. On the D drive, create a folder named SQLRP and extract the content of the zip file in it:

image

Copy the file AzureStack.SqlRP.Setup.*.nupkg to D:\SQLRP\AzureStack.SqlRP.Deployment.5.11.61.0\content\Deployment:

image

On this folder, create a new folder named Certificate and copy the wildcard certificate on it. Rename it to Certificate.pfx it is very important because the script is using this certificate name:

image

Go back to the Deployment folder and go in Templates. Edit the file InstallSqlRpComplete-Parameters.json. Fill in the value adminPassword with the admin password that you will use for your SQL RP and the certPassword with the password of your PFX. You can close your file.

Do the same in the file InstallSqlRpPackage-Parameters.json.

Change the value of cseBlobStorage with the new version name, AzureStack.SqlRP.Setup.5.11.61.0.nupkg:

image

Open a PowerShell prompt as Administrator and navigate to D:\SQLRP\AzureStack.SqlRP.Deployment.5.11.61.0\Content\Deployment:

image

Run the script SqlRPTemplateDeployment.ps1 with the following parameters, by replacing by your values to start the installation of the RP:

.\SqlRPTemplateDeployment.ps1 -AadTenantDirectoryName azurelabdvo.onmicrosoft.com -packageName "AzureStack.SqlRP.Setup.5.11.61.0.nupkg"

If you have the following error, type Set-ExecutionPolicy Unrestricted:

.\SqlRPTemplateDeployment.ps1 : File
D:\SQLRP\AzureStack.SqlRP.Deployment.5.11.61.0\content\Deployment\SqlRPTemplateDeployment.ps1 cannot be loaded. The
file D:\SQLRP\AzureStack.SqlRP.Deployment.5.11.61.0\content\Deployment\SqlRPTemplateDeployment.ps1 is not digitally
signed. You cannot run this script on the current system. For more information about running scripts and setting
execution policy, see about_Execution_Policies at http://go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ .\SqlRPTemplateDeployment.ps1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

image

You will be prompt to give your Global Admin credentials of your Azure AD:

image

The provisionning is in progress:

image

It can take 90 minutes to deploy the SQL RP because the script will deploy a new VM with SQL Server installed on Windows Server 2012 R2 (less than 60 minutes in my case). The deployment is now done:

image

Go on your ADVM and create a DNS entry with sqlrp with the IP address that you can find in the Public IP that the script has created:

image

image

The last step is to register the SQL Resource Provider in MAS. Execute the script Register-SqlRP.ps1 located in the folder D:\SQLRP\AzureStack.SqlRP.Deployment.5.11.61.0\content\Deployment with the following command:

.\Register-SqlRP.ps1 -AadTenantDirectoryName azurelabdvo.onmicrosoft.com

Log in to your Azure AD. For the Windows Credential request, give the following username sqlRpUsername and the following password sqlRpPassw0rd:

image

image

Add the RP to your subscription:

image

Click on New > Data + Storage > Sql Server Database and choose the server created before:

image

image When I launched the deployment, I have the following error:

image

Mark Scholman give me the solution on Twitter. You must add a SQL instance before doing this. To do this, go on the admin portal and navigate to Resource Providers > SQL-LOCAL > SQL Service > SQL Hosting Servers (by clicking on the 0 under Servers) and click on Add. Provide the instance name of the SQL Server, and the login/password to connect to this instance (with th port if needed):

image

image

My SQL database server has been created correctly, and I can connect to it:

image

image

image

Enjoy this new feature of MAS Sourire