|
| 1 | +--- |
| 2 | +title: Create an Azure DB for MariaDB using an ARM template |
| 3 | +description: In this article, learn how to create an Azure Database for MariaDB server by using an Azure Resource Manager template. |
| 4 | +author: mgblythe |
| 5 | +ms.service: mariadb |
| 6 | +ms.topic: quickstart |
| 7 | +ms.custom: subject-armqs |
| 8 | +ms.author: mblythe |
| 9 | +ms.date: 05/14/2020 |
| 10 | +--- |
| 11 | + |
| 12 | +# Quickstart: Use an ARM template to create an Azure Database for MariaDB server |
| 13 | + |
| 14 | +Azure Database for MariaDB is a managed service that you use to run, manage, and scale highly available MariaDB databases in the cloud. In this quickstart, you use an ARM template to create an Azure Database for MariaDB server in the Azure portal, PowerShell, or Azure CLI. |
| 15 | + |
| 16 | +[!INCLUDE [About Azure Resource Manager](../../includes/resource-manager-quickstart-introduction.md)] |
| 17 | + |
| 18 | +## Prerequisites |
| 19 | + |
| 20 | +# [Portal](#tab/azure-portal) |
| 21 | + |
| 22 | +An Azure account with an active subscription. [Create one for free](https://azure.microsoft.com/free/). |
| 23 | + |
| 24 | +# [PowerShell](#tab/PowerShell) |
| 25 | + |
| 26 | +* An Azure account with an active subscription. [Create one for free](https://azure.microsoft.com/free/). |
| 27 | +* If you want to run the code locally, [Azure PowerShell](/powershell/azure/). |
| 28 | + |
| 29 | +# [CLI](#tab/CLI) |
| 30 | + |
| 31 | +* An Azure account with an active subscription. [Create one for free](https://azure.microsoft.com/free/). |
| 32 | +* If you want to run the code locally, [Azure CLI](/cli/azure/). |
| 33 | + |
| 34 | +--- |
| 35 | + |
| 36 | +## Create an Azure Database for MariaDB server |
| 37 | + |
| 38 | +You create an Azure Database for MariaDB server with a defined set of compute and storage resources. To learn more, see [Azure Database for MariaDB pricing tiers](concepts-pricing-tiers.md). You create the server within an [Azure resource group](../azure-resource-manager/management/overview.md). |
| 39 | + |
| 40 | +### Review the template |
| 41 | + |
| 42 | +The template used in this quickstart is from [Azure quickstart templates](https://github.com/Azure/azure-quickstart-templates/tree/master/101-managed-mariadb-with-vnet/). |
| 43 | + |
| 44 | +:::code language="json" source="~/quickstart-templates/101-managed-mariadb-with-vnet/azuredeploy.json" range="001-231" highlight="149,162,176,199,213"::: |
| 45 | + |
| 46 | +The template defines five Azure resources: |
| 47 | + |
| 48 | +* [**Microsoft.Network/virtualNetworks**](/azure/templates/microsoft.network/virtualnetworks) |
| 49 | +* [**Microsoft.Network/virtualNetworks/subnets**](/azure/templates/microsoft.network/virtualnetworks/subnets) |
| 50 | +* [**Microsoft.DBforMariaDB/servers**](/azure/templates/microsoft.dbformariadb/servers) |
| 51 | +* [**Microsoft.DBforMariaDB/servers/virtualNetworkRules**](/azure/templates/microsoft.dbformariadb/servers/virtualnetworkrules) |
| 52 | +* [**Microsoft.DBforMariaDB/servers/firewallRules**](/azure/templates/microsoft.dbformariadb/servers/firewallrules) |
| 53 | + |
| 54 | +More Azure Database for MariaDB template samples can be found in [Azure quickstart templates](https://azure.microsoft.com/resources/templates/?resourceType=Microsoft.Dbformariadb&pageNumber=1&sort=Popular). |
| 55 | + |
| 56 | +## Deploy the template |
| 57 | + |
| 58 | +# [Portal](#tab/azure-portal) |
| 59 | + |
| 60 | +Select the following link to deploy the Azure Database for MariaDB server template in the Azure portal: |
| 61 | + |
| 62 | +[](https://portal.azure.com/#create/Microsoft.Template/uri/https%3a%2f%2fraw.githubusercontent.com%2fAzure%2fazure-quickstart-templates%2fmaster%2f101-managed-mariadb-with-vnet%2fazuredeploy.json) |
| 63 | + |
| 64 | +On the **Deploy Azure Database for MariaDB with VNet** page: |
| 65 | + |
| 66 | +1. For **Resource group**, select **Create new**, enter a name for the new resource group, and select **OK**. |
| 67 | + |
| 68 | +2. If you created a new resource group, select a **Location** for the resource group and the new server. |
| 69 | + |
| 70 | +3. Enter a **Server Name**, **Administrator Login**, and **Administrator Login Password**. |
| 71 | + |
| 72 | +  |
| 73 | + |
| 74 | +4. Change the other default settings if you want: |
| 75 | + |
| 76 | + * **Subscription**: the Azure subscription you want to use for the server. |
| 77 | + * **Sku Capacity**: the vCore capacity, which can be *2* (the default), *4*, *8*, *16*, *32*, or *64*. |
| 78 | + * **Sku Name**: the SKU tier prefix, SKU family, and SKU capacity, joined by underscores, such as *B_Gen5_1*, *GP_Gen5_2* (the default), or *MO_Gen5_32*. |
| 79 | + * **Sku Size MB**: the storage size, in megabytes, of the Azure Database for MariaDB server (default *51200*). |
| 80 | + * **Sku Tier**: the deployment tier, such as *Basic*, *GeneralPurpose* (the default), or *MemoryOptimized*. |
| 81 | + * **Sku Family**: *Gen4* or *Gen5* (the default), which indicates hardware generation for server deployment. |
| 82 | + * **Mariadb Version**: the version of MariaDB server to deploy, such as *10.2*, or *10.3* (the default). |
| 83 | + * **Backup Retention Days**: the desired period for geo-redundant backup retention, in days (default *7*). |
| 84 | + * **Geo Redundant Backup**: *Enabled* or *Disabled* (the default), depending on geo-disaster recovery (Geo-DR) requirements. |
| 85 | + * **Virtual Network Name**: the name of the virtual network (default *azure_mariadb_vnet*). |
| 86 | + * **Subnet Name**: the name of the subnet (default *azure_mariadb_subnet*). |
| 87 | + * **Virtual Network Rule Name**: the name of the virtual network rule allowing the subnet (default *AllowSubnet*). |
| 88 | + * **Vnet Address Prefix**: the address prefix for the virtual network (default *10.0.0.0/16*). |
| 89 | + * **Subnet Prefix**: the address prefix for the subnet (default *10.0.0.0/16*). |
| 90 | + |
| 91 | +5. Read the terms and conditions, and then select **I agree to the terms and conditions stated above**. |
| 92 | + |
| 93 | +6. Select **Purchase**. |
| 94 | + |
| 95 | +# [PowerShell](#tab/PowerShell) |
| 96 | + |
| 97 | +Use the following interactive code to create a new Azure Database for MariaDB server using the template. The code prompts you for the new server name, the name and location of a new resource group, and an administrator account name and password. |
| 98 | + |
| 99 | +To run the code in Azure Cloud Shell, select **Try it** at the upper corner of any code block. |
| 100 | + |
| 101 | +```azurepowershell-interactive |
| 102 | +$serverName = Read-Host -Prompt "Enter a name for the new Azure Database for MariaDB server" |
| 103 | +$resourceGroupName = Read-Host -Prompt "Enter a name for the new resource group where the server will exist" |
| 104 | +$location = Read-Host -Prompt "Enter an Azure region (for example, centralus) for the resource group" |
| 105 | +$adminUser = Read-Host -Prompt "Enter the Azure Database for MariaDB server's administrator account name" |
| 106 | +$adminPassword = Read-Host -Prompt "Enter the administrator password" -AsSecureString |
| 107 | +
|
| 108 | +New-AzResourceGroup -Name $resourceGroupName -Location $location # Use this command when you need to create a new resource group for your deployment |
| 109 | +New-AzResourceGroupDeployment -ResourceGroupName $resourceGroupName ` |
| 110 | + -TemplateUri https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-managed-mariadb-with-vnet/azuredeploy.json ` |
| 111 | + -serverName $serverName ` |
| 112 | + -administratorLogin $adminUser ` |
| 113 | + -administratorLoginPassword $adminPassword |
| 114 | +
|
| 115 | +Read-Host -Prompt "Press [ENTER] to continue: " |
| 116 | +``` |
| 117 | + |
| 118 | +# [CLI](#tab/CLI) |
| 119 | + |
| 120 | +Use the following interactive code to create a new Azure Database for MariaDB server using the template. The code prompts you for the new server name, the name and location of a new resource group, and an administrator account name and password. |
| 121 | + |
| 122 | +To run the code in Azure Cloud Shell, select **Try it** at the upper corner of any code block. |
| 123 | + |
| 124 | +```azurecli-interactive |
| 125 | +read -p "Enter a name for the new Azure Database for MariaDB server:" serverName && |
| 126 | +read -p "Enter a name for the new resource group where the server will exist:" resourceGroupName && |
| 127 | +read -p "Enter an Azure region (for example, centralus) for the resource group:" location && |
| 128 | +read -p "Enter the Azure Database for MariaDB server's administrator account name:" adminUser && |
| 129 | +read -p "Enter the administrator password:" adminPassword && |
| 130 | +params='serverName='$serverName' administratorLogin='$adminUser' administratorLoginPassword='$adminPassword && |
| 131 | +az group create --name $resourceGroupName --location $location && |
| 132 | +az deployment group create --resource-group $resourceGroupName --parameters $params --template-uri https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-managed-mariadb-with-vnet/azuredeploy.json && |
| 133 | +read -p "Press [ENTER] to continue: " |
| 134 | +``` |
| 135 | + |
| 136 | +--- |
| 137 | + |
| 138 | +## Review deployed resources |
| 139 | + |
| 140 | +# [Portal](#tab/azure-portal) |
| 141 | + |
| 142 | +Follow these steps to see an overview of your new Azure Database for MariaDB server: |
| 143 | + |
| 144 | +1. In the [Azure portal](https://portal.azure.com), search for and select **Azure Database for MariaDB servers**. |
| 145 | + |
| 146 | +2. In the database list, select your new server. The **Overview** page for your new Azure Database for MariaDB server appears. |
| 147 | + |
| 148 | +# [PowerShell](#tab/PowerShell) |
| 149 | + |
| 150 | +Run the following interactive code to view details about your Azure Database for MariaDB server. You'll have to enter the name of the new server. |
| 151 | + |
| 152 | +```azurepowershell-interactive |
| 153 | +$serverName = Read-Host -Prompt "Enter the name of your Azure Database for MariaDB server" |
| 154 | +Get-AzResource -ResourceType "Microsoft.DbForMariaDB/servers" -Name $serverName | ft |
| 155 | +Read-Host -Prompt "Press [ENTER] to continue: " |
| 156 | +``` |
| 157 | + |
| 158 | +# [CLI](#tab/CLI) |
| 159 | + |
| 160 | +Run the following interactive code to view details about your Azure Database for MariaDB server. You'll have to enter the name and the resource group of the new server. |
| 161 | + |
| 162 | +```azurecli-interactive |
| 163 | +read -p "Enter your Azure Database for MariaDB server name: " serverName && |
| 164 | +read -p "Enter the resource group where the Azure Database for MariaDB server exists: " resourcegroupName && |
| 165 | +az resource show --resource-group $resourcegroupName --name $serverName --resource-type "Microsoft.DbForMariaDB/servers" && |
| 166 | +read -p "Press [ENTER] to continue: " |
| 167 | +``` |
| 168 | + |
| 169 | +--- |
| 170 | + |
| 171 | +## Clean up resources |
| 172 | + |
| 173 | +When it's no longer needed, delete the resource group, which deletes the resources in the resource group. |
| 174 | + |
| 175 | +# [Portal](#tab/azure-portal) |
| 176 | + |
| 177 | +1. In the [Azure portal](https://portal.azure.com), search for and select **Resource groups**. |
| 178 | + |
| 179 | +2. In the resource group list, choose the name of your resource group. |
| 180 | + |
| 181 | +3. In the **Overview** page of your resource group, select **Delete resource group**. |
| 182 | + |
| 183 | +4. In the confirmation dialog box, type the name of your resource group, and then select **Delete**. |
| 184 | + |
| 185 | +# [PowerShell](#tab/PowerShell) |
| 186 | + |
| 187 | +```azurepowershell-interactive |
| 188 | +$resourceGroupName = Read-Host -Prompt "Enter the Resource Group name" |
| 189 | +Remove-AzResourceGroup -Name $resourceGroupName |
| 190 | +Read-Host -Prompt "Press [ENTER] to continue: " |
| 191 | +``` |
| 192 | + |
| 193 | +# [CLI](#tab/CLI) |
| 194 | + |
| 195 | +```azurecli-interactive |
| 196 | +read -p "Enter the Resource Group name: " resourceGroupName && |
| 197 | +az group delete --name $resourceGroupName && |
| 198 | +read -p "Press [ENTER] to continue: " |
| 199 | +``` |
| 200 | + |
| 201 | +--- |
| 202 | + |
| 203 | +## Next steps |
| 204 | + |
| 205 | +For a step-by-step tutorial that guides you through the process of creating a template, see: |
| 206 | + |
| 207 | +> [!div class="nextstepaction"] |
| 208 | +> [ Tutorial: Create and deploy your first Azure Resource Manager template](../azure-resource-manager/templates/template-tutorial-create-first-template.md) |
0 commit comments