Azure stack on azure part 3

Ned Bellavance
6 min read


In the last two parts we deployed an Azure Stack Development Kit on an Azure VM and got it registered with Azure. Then we created an Offer and Plan for the default user and started the download of marketplace items for use on Azure Stack. Now that those items have completed their download, we can move on to the process of installing the Resource Providers (RPs) for Microsoft SQL Server (MSSQL), MySQL Server, and the App Service. In this post I will cover the process and scripts you can use to get the MSSQL and MySQL RPs running. The App Service will be a separate post, due to the additional complexity involved.

The MSSQL and MySQL RPs consist of a VM running Windows Server 2016 Core that acts as a broker for the Resource Provider. It doesn’t actually provide the databases services itself, so you will need something to provide those services outside of the standard deployment. The parlance used by Azure Stack is a hosting server, which could actually be a cluster of servers - as in a SQL Server AlwaysOn Availability Group. In a production deployment you could choose to run the databases services as VMs on Azure Stack in a dedicated subscription, or you could provide the services from database servers that live outside the Azure Stack hardware. For the purposes of the ASDK, we are going to create a VM running Microsoft SQL Server 2017 on Windows Server 2016, at least that’s what I have specified in the template. Any Microsoft SQL installation 2014 and newer should work. You could even get SQL on Linux working if you really wanted to.

Within the directories that are pulled from GitHub is the C:\AzureStackonAzureVM\RPs\MSSQL directory. That contains the deployment template for the VM that will supply the MSSQL database services. In order to deploy the template and Resource Provider, you will run the MSSQLDeploy.ps1 script. The script requires two parameters. First run the following to get values for those parameters.

$AzureStackAdmin = Get-Credential -Message "Enter Azure AD Admin credentials"
$cloudAdminCreds = Get-Credential -Message "Enter Azure cloudAdmin credentials"

If you are running the script from a non-default path, then make sure to also supply a value for the $defaultLocalPath parameter. The AzureStackAdmin should be the administrative account that you have been using to deploy Azure Stack resources.

AzureStack Credentials

The cloudAdminCreds will be the AzureStack\cloudadmin account, which has the same password as the one used for the local admin account AzureStackAdmin.

CloudAdmin Credentials

Go ahead and run the script as shown below:

.\MSSQLDeploy.ps1 -AzureStackAdmin $AzureStackAdmin -cloudAdminCreds $cloudAdminCreds

The script will prompt you for a password to use for the local Administrator (mssqladmin) on the SQL Server, which will also serve as the sa password.

mssqladmin credentials

Then it will deploy the SQL 2017 server on AzureStack in the default provider subscription, creating a new resource group called MSSQL.

Resource group deployment

The template exposes port 1433 on its public IP address and uses a public DNS name of mssql01.local.cloudapp.azurestack.external. That value will be used to configure database services for the resource provider after it has been deployed.

MSSQL deployment

After a successful deployment of MSSQL01, the script downloads and expands the latest MSSQL RP files from the internet and configures some of the parameters for the RP deployment. The VM running the services will be using the super secure password of “P@ssw0rd1”, though you can change that to something else in the script if you would like. Finally the script calls the DeploySQLProvider.ps1 script with the necessary parameters to deploy the VM and the resource provider components. The whole process will take a while, so I recommend going to get a caffeinated beverage or something similar.

Complete deployment

Once the resource provider is done its work, you will need to set up a database server connection, and create a plan for the MSSQL provider. If you are already logged into the Admin portal, I recommend logging out and back in. The new provider may not show as available otherwise. Under all services in the Administrative Resources section, you will now see a SQL Hosting Servers section.

SQL Hosting

Clicking on that will take you to a blade where you can add, edit, and remove hosting servers that are providing MSSQL database services.

Add hosting server

There doesn’t appear to be any PowerShell cmdlets for this yet… yet. It’s one more thing on my list of stuff to do. Click Add and go through the workflow to add a SQL hosting server. You will need the public IP address or public DNS name of the MSSQL server the script created earlier. Assuming you haven’t altered the script, the public DNS should be mssql01.local.cloudapp.azurestack.external.

Hosting server settings

You will also need to create a SKU that users can select when they are adding databases. The SKU is meant to define the capabilities being offered to the user, so things like version, edition, and HA status of the MSSQL server would all be applicable.

SKU config

The SKU can take up to an hour to generate, so once you add the MSSQL RP to a plan it may still take an hour for the user to create a database.

Added hosting server

Once the hosting server is successfully added, we can go ahead and create a Plan and Quota for the service and add it to the existing default offer.

Creating Plan

Adding Quota

This makes the MSSQL plan an optional add-on plan for subscribers using the default offer.

Completed Plan

Once that is all saved, you can log in to the user portal and add a plan to your user subscription.

Adding the plan

Once it’s added to the subscription, you will be able to deploy a SQL DB, assuming that the SKU has had time to be added to the service.

Adding a SQL DB

The process for the MySQL RP is very similar. The VM running the MySQL service is actually a Windows Server 2016 instance with MySQL installed on it. The script is sitting in the C:\AzureStackonAzureVM\RPs\MySQL directory, and I creatively named it DeployMySQL.ps1. The parameters you need to supply are the same, so if you still have the PowerShell session open from running the MSSQL RP, you can go ahead and run:

.\MySQLDeploy.ps1 -AzureStackAdmin $AzureStackAdmin -cloudAdminCreds $cloudAdminCreds

The VM providing the service in this case will be MySQL01 with a public DNS of mysql01.local.cloudapp.azurestack.external. You will be prompted for the mysqladmin credentials, which will be used for both the local Administrator account on the VM and the sysadmin for the MySQL installation.

mysqladmin credentials

The resource provider VM again is using the super secret password of “P@ssw0rd1”. This script will take about as long as the MSSQL script to complete.

Now that it has been deployed successfully, the steps are the same as what we ran through to set up the MSSQL RP.

  1. Add a hosting server with a SKU
  2. Add a Plan and Quota to an Offer
  3. Wait a suitable amount of time for the SKU to deploy
  4. Add the plan to the user subscription
  5. Deploy a MySQL DB

Obviously capacity is somewhat limited on these VMs, but this is a PoC after all. You could instead choose to provide services from a VM running in Azure outside of the ASDK. I haven’t tried it, but I don’t see why it wouldn’t work. Maybe I can put that on the list of things to develop as well.

Next post we will be installing the App Service RP using a script, and I’ll talk a little about why you might not want to do that.