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
- Deploy the MySQL Resource Provider
- Install MySQL on the MySQL RP adapter VM
- Add the MySQL RP adapter VM as a MySQL Hosting Server
- Create a MySQL database
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:
Variable | Description |
---|---|
$TempDir | This should be the directory you extracted the MySQL RP installation files to |
$AADGlobalAdmin | This should be the username of a Global Administrator in your Azure subscription. Format: username@mydirectory.onmicrosoft.com |
$AADGlobalAdminPW | This should be the password for the above user |
$VMLocalAdminPass | This should be a password for the local administrator account on the MySQL VM being deployed |
$ASDKAdminPass | This should be the password for the AzureStack\AzureStackAdmin user |
$PfxPass | This should be a password for exporting your certificates as .pfx - Choose whatever suits you 🙂 |
$ERCS01IP | This 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…

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”

- Accept the license terms and click “Next”

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

- 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”


- Now click “Execute” to install MySQL Server

- Now click “Next”

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

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

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

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


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


- Click “Execute” to apply your configuration

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

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”

- As with the MSSQL Hosting Server, populate the blade (guide table below), create a “SKU” and click “Create”
Field | Expected Value |
---|---|
MySQL Hosting Server Name | The name of the MySQL VM deployed by the script earlier |
Username | Should be "mysqlrpadmin" |
Password | You set this during the deployment of the MySQL adapter |
Size of Hosting Server in GB | Enter anything you want here within reason |
Subscription | Leave the default value |
Resource Group | Either create a new one or use an existing if you prefer |
Location | Leave the default value |
SKU | Create as per instructions below |

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

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

Create a MySQL database
OK, now let’s provision ourselves a MySQL database.
- Click “+ New”, “Data + Storage” and “MySQL Database”

- Populate the blade as required using the table below as a guide
Field | Description |
---|---|
Database Name | Give your database a name, no more than 32 characters |
Collation | Leave at the default unless there is a reason to change it |
Subscription | Leave the default value |
Resource Group | Create a new one or deploy your new database into an existing one |
Location | Leave the default value |
SKU | Select from the available SKUs created by the Service Provider |
Login | Create 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

Success!

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

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.