|
| 1 | +--- |
| 2 | +title: 'Quickstart: Create an Azure DB for MariaDB - Bicep' |
| 3 | +description: In this Quickstart article, learn how to create an Azure Database for MariaDB server using Bicep. |
| 4 | +author: schaffererin |
| 5 | +ms.author: v-eschaffer |
| 6 | +ms.date: 04/28/2022 |
| 7 | +ms.topic: quickstart |
| 8 | +ms.service: mariadb |
| 9 | +ms.custom: devx-track-azurepowershell, subject-armqs, mode-arm |
| 10 | +--- |
| 11 | + |
| 12 | +# Quickstart: Use Bicep 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 Bicep to create an Azure Database for MariaDB server in PowerShell or Azure CLI. |
| 15 | + |
| 16 | +[!INCLUDE [About Bicep](../../includes/resource-manager-quickstart-bicep-introduction.md)] |
| 17 | + |
| 18 | +## Prerequisites |
| 19 | + |
| 20 | +You'll need an Azure account with an active subscription. [Create one for free](https://azure.microsoft.com/free/). |
| 21 | + |
| 22 | +## Review the Bicep file |
| 23 | + |
| 24 | +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). |
| 25 | + |
| 26 | +The Bicep file used in this quickstart is from [Azure Quickstart Templates](https://azure.microsoft.com/resources/templates/managed-mariadb-with-vnet/). |
| 27 | + |
| 28 | +:::code language="bicep" source="~/quickstart-templates/quickstarts/microsoft.dbformariadb/managed-mariadb-with-vnet/main.bicep"::: |
| 29 | + |
| 30 | +The Bicep file defines five Azure resources: |
| 31 | + |
| 32 | +* [**Microsoft.Network/virtualNetworks**](/azure/templates/microsoft.network/virtualnetworks) |
| 33 | +* [**Microsoft.Network/virtualNetworks/subnets**](/azure/templates/microsoft.network/virtualnetworks/subnets) |
| 34 | +* [**Microsoft.DBforMariaDB/servers**](/azure/templates/microsoft.dbformariadb/servers) |
| 35 | +* [**Microsoft.DBforMariaDB/servers/virtualNetworkRules**](/azure/templates/microsoft.dbformariadb/servers/virtualnetworkrules) |
| 36 | +* [**Microsoft.DBforMariaDB/servers/firewallRules**](/azure/templates/microsoft.dbformariadb/servers/firewallrules) |
| 37 | + |
| 38 | +## Deploy the Bicep file |
| 39 | + |
| 40 | +1. Save the Bicep file as **main.bicep** to your local computer. |
| 41 | +1. Deploy the Bicep file using either Azure CLI or Azure PowerShell. |
| 42 | + |
| 43 | + # [CLI](#tab/CLI) |
| 44 | + |
| 45 | + ```azurecli |
| 46 | + az group create --name exampleRG --location eastus |
| 47 | + az deployment group create --resource-group exampleRG --template-file main.bicep --parameters serverName=<server-name> administratorLogin=<admin-login> |
| 48 | + ``` |
| 49 | +
|
| 50 | + # [PowerShell](#tab/PowerShell) |
| 51 | +
|
| 52 | + ```azurepowershell |
| 53 | + New-AzResourceGroup -Name exampleRG -Location eastus |
| 54 | + New-AzResourceGroupDeployment -ResourceGroupName exampleRG -TemplateFile ./main.bicep -serverName "<server-name>" -administratorLogin "<admin-login>" |
| 55 | + ``` |
| 56 | +
|
| 57 | + --- |
| 58 | +
|
| 59 | + > [!NOTE] |
| 60 | + > Replace **\<server-name\>** with the name of the server. Replace **\<admin-login\>** with the database administrator login name. The minimum required length is one character. You'll also be prompted to enter **administratorLoginPassword**. The minimum password length is eight characters. |
| 61 | +
|
| 62 | + When the deployment finishes, you should see a message indicating the deployment succeeded. |
| 63 | +
|
| 64 | +## Review deployed resources |
| 65 | +
|
| 66 | +Use the Azure portal, Azure CLI, or Azure PowerShell to list the deployed resources in the resource group. |
| 67 | +
|
| 68 | +# [CLI](#tab/CLI) |
| 69 | +
|
| 70 | +```azurecli-interactive |
| 71 | +az resource list --resource-group exampleRG |
| 72 | +``` |
| 73 | + |
| 74 | +# [PowerShell](#tab/PowerShell) |
| 75 | + |
| 76 | +```azurepowershell-interactive |
| 77 | +Get-AzResource -ResourceGroupName exampleRG |
| 78 | +``` |
| 79 | + |
| 80 | +--- |
| 81 | + |
| 82 | +## Clean up resources |
| 83 | + |
| 84 | +When no longer needed, use the Azure portal, Azure CLI, or Azure PowerShell to delete the resource group and its resources. |
| 85 | + |
| 86 | +# [CLI](#tab/CLI) |
| 87 | + |
| 88 | +```azurecli-interactive |
| 89 | +az group delete --name exampleRG |
| 90 | +``` |
| 91 | + |
| 92 | +# [PowerShell](#tab/PowerShell) |
| 93 | + |
| 94 | +```azurepowershell-interactive |
| 95 | +Remove-AzResourceGroup -Name exampleRG |
| 96 | +``` |
| 97 | + |
| 98 | +--- |
| 99 | + |
| 100 | +## Next steps |
| 101 | + |
| 102 | +For a step-by-step tutorial that guides you through the process of creating a Bicep file using Visual Studio Code, see: |
| 103 | + |
| 104 | +> [!div class="nextstepaction"] |
| 105 | +> [Quickstart: Create Bicep files with Visual Studio Code](../azure-resource-manager/bicep/quickstart-create-bicep-use-visual-studio-code.md) |
0 commit comments