Check! Deploy Azure Database for MySQL with using ARM template

Kazumi IWANAGA (OHIRA)
2 min readApr 5, 2018

Microsoft provides Azure Database for MySQL. Captured from https://azure.microsoft.com/en-us/blog/azure-database-for-mysql-public-preview/.

Prologue

I’m glad that Azure Database for MySQL became General Availability(GA).

Immediately I tried to deploy by ARM template, but because the documentation is not enough now, it’s is difficult a little. So I wrote this post, you can deploy Azure Database for MySQL by ARM according to the following information.

If you want to know more details, please refer below documents.

Deploy MySQL with an empty database

I created a sample template to deploy Azure Database for MySQL with an empty database.

You can deploy on Azure Portal, click below link.

And you can deploy by Azure CLI. Download above files and change parameters like password, and execute below commands.

GROUP=<resource group name>
LOCATION=<resource group location>
az group create -n ${GROUP} -l ${LOCATION}
az group deployment create -g ${GROUP} --template-file azuredeploy.json --parameters @parameters.json

Tips: Trick of sku name

Above documents show the following naming role of Sku name.

The name of the sku, typically, tier + family + cores, e.g. B_Gen4_1, GP_Gen5_8.

The tier symbol is like below.

Basic => B
General Purpose => GP
Memory Optimized => MO

There are rules for the combination (each tier x family x cores). Below page’s list helps you to know the combination.

Sample to generate the sku name

With the following code, you can generate the sku name from each parts.

"parameters": {
"databaseForMySqlTier": {
"type": "string",
"defaultValue": "Basic",
"allowedValues": [
"Basic",
"GeneralPurpose",
"MemoryOptimized"
]
},
"databaseForMySqlFamily": {
"type": "string",
"defaultValue": "Gen4",
"allowedValues": [
"Gen4",
"Gen5"
]
},
"databaseForMySqlCores": {
"type": "int",
"defaultValue": 1,
"allowedValues": [
1,
2,
4,
8,
16,
32
]
}
},

Then joined them as a variable.

"variables": {
"databaseForMySqlSku": "[concat(variables('tierSymbol')[parameters('databaseForMySqlTier')], '_', parameters('databaseForMySqlFamily'), '_', parameters('databaseForMySqlCores'))]",
"tierSymbol": {
"Basic": "B",
"GeneralPurpose": "GP",
"MemoryOptimized": "MO"
}
},

Deploy MySQL from a backup

If you want to create Azure Database for MySQL from backup, refer these options.

Epilogue

If I deployed wrong parameters, the operation returned hints to correct parameter. It helped me to fix my template.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Kazumi IWANAGA (OHIRA)
Kazumi IWANAGA (OHIRA)

Written by Kazumi IWANAGA (OHIRA)

Hello! :) I’m a developer, Microsoft MVP(Azure). My interests: Azure, Serverless, IaC, Container, IoT, and other many exciting things!

No responses yet

Write a response