Spring over navigation

Automate your Azure Database for MySQL deployments using ARM templates

Udgivet den 1 november, 2018

This blog is authored by Parikshit Savjani, Senior Program Manager, Microsoft Azure 

The Azure Database for MySQL REST API enables DevOps engineers to automate and integrate provisioning while configuring and operating managed MySQL servers and databases in Azure. The API allows the creation, enumeration, management, and deletion of MySQL servers and databases on the Azure Database for MySQL service.

Azure Resource Manager (ARM) templates leverage the underlying REST API to declare and program the Azure resources required for deployments at scale, aligning with infrastructure as a code concept. The template parameterizes the Azure resource name, SKU, network, firewall configuration, and settings, allowing it to be created one time and used multiple times. ARM templates can be easily created using the Azure portal or Visual Studio Code. They enable application packaging, standardization, and deployment automation, which can be integrated into the DevOps CI/CD pipeline. For instance, if you are looking to quickly deploy a web app with Azure Database for MySQL database, you can perform the end-to-end deployment using our Azure QuickStart template from the GitHub gallery.

You can learn more in our documentation about JSON template reference for an Azure Database for MySQL server.

If you are looking to build an ARM template to automate Azure Database for MySQL deployments for your organization, we would recommend you to start with our Azure Quickstart template first and build on top of it. If you encounter any issues or wish to contribute back, please raise an issue or send pull request via GitHub.

If you are new to ARM templates and would like to try it, you can start by following these steps:

  • Clone or download the sample Azure QuickStart template from the Github gallery.
  • Modify the azuredeploy.parameters.json to update the parameter values based on your preference and save the file.
  • Use Azure Powershell or  Azure cli to create the Azure Database for MySQL server using the following commands.

Azure Powershell

Connect-AzureRmAccount
Select-AzureRmSubscription -SubscriptionName <yourSubscriptionName>
New-AzureRmResourceGroup -Name ExampleResourceGroup -Location "West US2"
New-AzureRmResourceGroupDeployment -Name ExampleDeployment -ResourceGroupName ExampleResourceGroup -TemplateFile c:\MyTemplates\azuredeploy.json -TemplateParameterFile c:\MyTemplates\azuredeploy.parameters.json

Azure Cli

az login
az group create -n ExampleResourceGroup  -l “West US2”
az group deployment create -g $ ExampleResourceGroup   --template-file $ {templateloc} --parameters $ {parametersloc}

If you would like to quickly deploy an Azure Database for MySQL server with virtual network integration, you can click on the deploy button below which leverages the sample ARM template discussed.

deploybutton

More choice for management and deployment to Azure

If you are using HashiCorp’s Terraform to manage your cloud infrastructure, you can leverage azurerm_mysql_server, azurerm_mysql_firewall_rule, azurerm_mysql_configuration, azurerm_mysql_virtual_network_rule and azurerm_mysql_database templates where the team is actively contributing and plugged in.

If you are looking to quickly deploy a web app with Azure Database for MySQL database using HashiCorp Terraform, you can perform the end-to-end deployment using our Terraform QuickStart template from the GitHub gallery.

If you are looking to package, re-platform or modernize your traditional applications, you can also use Bitnami Stacksmith which can generate ARM templates for you that will automatically set up and connect you to a managed Azure Database for MySQL service in Azure.

Next steps

Please continue to provide feedback on the features and functionality that you want to see next. If you need any help or have questions, please check out the Azure Database for MySQL documentation. Follow us on Twitter @AzureDBMySQL latest news and announcements.

Acknowledgments

Special thanks to Brian Moore, Mark Gray, Kamaljit Bath, Qingqing Yuan, Bassu Hiremath, Jim Toland, Mark Bolz, Diana Putnam, and Harini Gupta for their contributions to this posting.