Part 3: Deploy MySQL Resource Provider into ASDK

Previous Post in Series:  Part 2: Deploy MSSQL Resource Provider into ASDK

Welcome back folks. We now have the ability to provide self-service SQL databases on our ASDK deployment, but it’s not a party until we can also provide MySQL DBs as a Service too…so let’s crack on and attend to that shall we?

Here’s a list of what we’re going to do in this section of the guide:

Download Required Files

First things first, we’ll need to grab a hold of the SQL RP Binaries file. The code below will take care of that by doing the following:

  • Download MySQL RP binaries file
  • Extract the contents of the zipped archive to C:\Temp\MySQLRP

Launch an elevated PowerShell console, paste in the following code and execute it:

# Download SQL RP Binaries File
Invoke-WebRequest -Uri https://aka.ms/azurestackmysqlrp -OutFile C:\Temp\MySQLRP.exe

# Create Directory for files extracted from above .exe
New-Item -ItemType Directory -Path C:\Temp\MySQLRP\

# Extract files from WinRAR SFX archive
cd C:\Temp
.\MySQLRP.exe -dC:\Temp\MySQLRP -s

 

Deploy the MySQL Resource Provider

As with the MSSQL RP deployment, before we can run the “DeployMySQLProvider.ps1” script, we’ll have to make a quick modification to it. Earlier in the guide, we downloaded an image…this image is full GUI, the above script is set to look for a CORE image by default. Luckily though, this is a quick change to allow our deployment to continue on without issue.

  • Launch an elevated PowerShell ISE console and open “C:\Temp\MySQLRP\DeployMySQLProvider.ps1”
  • Search for the following line “$Core = $true” – it was line 59 in the script at the time of writing
  • Change this line to: “$Core = $false”
  • Now save and close the file

You’ll be running a PowerShell cmdlet in a minute, the table below shows what information each variable is expecting:

VariableDescription
$TempDirThis should be the directory you extracted the MySQL RP installation files to
$AADGlobalAdminThis should be the username of a Global Administrator in your Azure subscription. Format: username@mydirectory.onmicrosoft.com
$AADGlobalAdminPWThis should be the password for the above user
$VMLocalAdminPassThis should be a password for the local administrator account on the MySQL VM being deployed
$ASDKAdminPassThis should be the password for the AzureStack\AzureStackAdmin user
$PfxPassThis should be a password for exporting your certificates as .pfx - Choose whatever suits you 🙂
$ERCS01IPThis should be the IP address of the Azs-ERCS01 VM that's deployed as part of the ASDK
  • Launch an elevated PowerShell ISE console, paste in the following code, modify it as required and run it.
# This should be the directory where you extracted the MySQL RP installation files to
$TempDir = 'C:\TEMP\MySQLRP'

# This should be the IP address of the Azs-ERCS01 VM that's deployed as part of the ASDK
$ERCS01IP = 'IP Address'

# This should be the credentials for a Global Administrator on your Azure subscription
$AADGlobalAdmin = 'username@mydirectory.onmicrosoft.com'
$AADGlobalAdminPW = ConvertTo-SecureString 'Password here' -AsPlainText -Force
$AADGlobalAdminCred = New-Object System.Management.Automation.PSCredential ($AADGlobalAdmin, $AADGlobalAdminPW)

# Set the credentials for the Resource Provider VM
$VMLocalAdminPass = ConvertTo-SecureString "Password Here" -AsPlainText -Force
$VMLocalAdminCred = New-Object System.Management.Automation.PSCredential ("mysqlrpadmin", $VMLocalAdminPass)

# Set the AzureStackAdmin credential required for Privileged Endpoint access
$ASDKAdminPass = ConvertTo-SecureString "Password here" -AsPlainText -Force
$ASDKAdminCred = New-Object System.Management.Automation.PSCredential ("AzureStack\AzureStackAdmin", $ASDKAdminPass)

# Change the following as appropriate
$PfxPass = ConvertTo-SecureString "Password here" -AsPlainText -Force

# Run the installation script from the folder where you extracted the installation files
.$TempDir\DeployMySQLProvider.ps1 -AzCredential $AADGlobalAdminCred `
    -VMLocalCredential $VMLocalAdminCred `
    -CloudAdminCredential $ASDKAdminCred `
    -PrivilegedEndpoint $ERCS01IP `
    -DefaultSSLCertificatePassword $PfxPass -DependencyFilesLocalPath $TempDir\cert `
    -AcceptLicense

Success looks like this…

clip_image001

 

Install MySQL on the MySQL RP adapter VM

As with the MSSQL deployment, now that we’ve got the RP deployed, we’ll need to install MySQL on a hosting server. To save space on the environment, I’ve again elected to install this on the MySQL RP adapter VM, in production though, you’d ideally want this on a dedicated VM.

First things first, log onto the MySQL VM that was deployed above (using the mysqlrpadmin user credentials). Once logged on, open a browser and download the MySQL for Windows installer, you can get it HERE

NOTE:  Be aware that I accidentally selected the x64 version of MySQL Server on my first run through. This will fail to deploy because the Connector deployed as part of the MySQL RP is 32 bit. As such, a couple of my screenshots (couldn’t re-do them) show the x64 version being installed, IGNORE THIS AND GO WITH THE 32 BIT VERSION 🙂

  • Once downloaded, launch the installer and click “Add”

clip_image002

  • Accept the license terms and click “Next”

clip_image003

  • Browse to “MySQL Server 5.7.20 -X64” and click the arrow to add it
  • Now click “Next”

clip_image004

  • The installer will now advise that it requires the “C++ 2013 Redistributable Package (32 bit)”, click “Execute” to have the installer attend to this requirement
  • This will run through the install and update the requirements status
  • Now click “Next”

clip_image005

clip_image006

  • Now click “Execute” to install MySQL Server

clip_image007

  • Now click “Next”

clip_image008

  • Now we need to configure our MySQL deployment, click “Next”

clip_image009

  • Select “Standalone MySQL Server / Classic MySQL Replication” and click “Next”

clip_image010

  • Select “Server Machine” from the “Config Type” down-drop box and click “Next”

clip_image011

  • Enter a value for the “MySQL Root Password”
  • Click “Add User” and specify “Username”, “Role” and “Password” values before clicking “OK”
  • Now click “Next”

clip_image012

clip_image013

  • Accept the defaults on the “Windows Service” and the “Plugins and Extensions” pages and click “Next”

clip_image014

clip_image015

  • Click “Execute” to apply your configuration

clip_image016

  • All going well, your deployment should show a sea o’ green, assuming that, click “Finish”, “Next” and “Finish”
  • You can now close the installer

clip_image017

 

Add the MySQL RP adapter VM as a MySQL Hosting Server

Now that we’ve got our RP deployed and a hosting server configured, lets connect it all together.

  • Select “More Services”, “MySQL Hosting Servers” and click “Add”

clip_image018

  • As with the MSSQL Hosting Server, populate the blade (guide table below), create a “SKU” and click “Create”
FieldExpected Value
MySQL Hosting Server NameThe name of the MySQL VM deployed by the script earlier
UsernameShould be "mysqlrpadmin"
PasswordYou set this during the deployment of the MySQL adapter
Size of Hosting Server in GBEnter anything you want here within reason
SubscriptionLeave the default value
Resource GroupEither create a new one or use an existing if you prefer
LocationLeave the default value
SKUCreate as per instructions below

clip_image019

You’ll receive a notification upon successful deployment of your MySQL Hosting Server

clip_image020

  • Click “Refresh” to view you’re your new hosting server in the portal

clip_image021

 

Create a MySQL database

OK, now let’s provision ourselves a MySQL database.

  • Click “+ New”, “Data + Storage” and “MySQL Database”

clip_image022

  • Populate the blade as required using the table below as a guide
FieldDescription
Database NameGive your database a name, no more than 32 characters
CollationLeave at the default unless there is a reason to change it
SubscriptionLeave the default value
Resource GroupCreate a new one or deploy your new database into an existing one
LocationLeave the default value
SKUSelect from the available SKUs created by the Service Provider
LoginCreate login credentials to your database and click "OK"

NOTE:  I chose to ignore the advice from Microsoft advising that the SKUs can take up to an hour to become available in the portal…apparently that’s good information as I couldn’t create a database for 45 minutes after deploying the hosting server for this reason. So if you run into the same issue, just go for lunch or something and come back do this afterwards 🙂

  • Back (after waiting an hour) and I can create a MySQL database without issue

clip_image023

Success!

clip_image024

If we look in the portal, we can also see connection string for our new database, notice the username and password.

clip_image025

OK, that takes care of our database needs for the time being, let’s move on and deploy the App Service Resource Provider in Part 4.

Leave a Reply

Your email address will not be published. Required fields are marked *