Skip to content

Commit 291723b

Browse files
authored
Merge pull request #196820 from schaffererin/0502-mysql-create-quickstart
Creating new Bicep quickstart - MySQL Single Server
2 parents c04c29f + 79648d2 commit 291723b

File tree

3 files changed

+123
-0
lines changed

3 files changed

+123
-0
lines changed

articles/azure-resource-manager/bicep/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@
8787
href: ../../cosmos-db/sql/quick-create-bicep.md?toc=/azure/azure-resource-manager/bicep/toc.json
8888
- name: Database for MariaDB
8989
href: ../../mariadb/quickstart-create-mariadb-server-database-bicep.md?toc=/azure/azure-resource-manager/bicep/toc.json
90+
- name: Database for MySQL
91+
href: ../../mysql/quickstart-create-mysql-server-database-using-bicep.md?toc=/azure/azure-resource-manager/bicep/toc.json
9092
- name: Database for PostgreSQL
9193
href: ../../postgresql/quickstart-create-postgresql-server-database-using-bicep.md?toc=/azure/azure-resource-manager/bicep/toc.json
9294
- name: Database Migration Service

articles/mysql/TOC.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,9 @@
287287
- name: Azure PowerShell
288288
href: quickstart-create-mysql-server-database-using-azure-powershell.md
289289
displayName: powershell, create, server
290+
- name: Bicep
291+
href: quickstart-create-mysql-server-database-using-bicep.md
292+
displayName: ARM, Resource Manager, Template
290293
- name: ARM template
291294
href: quickstart-create-mysql-server-database-using-arm-template.md
292295
displayName: deploy azure resource manager template
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
---
2+
title: 'Quickstart: Create an Azure DB for MySQL - Bicep'
3+
description: In this Quickstart, learn how to create an Azure Database for MySQL server with virtual network integration using Bicep.
4+
author: schaffererin
5+
ms.author: v-eschaffer
6+
ms.service: mysql
7+
ms.topic: quickstart
8+
ms.custom: subject-armqs, devx-track-azurepowershell, mode-arm
9+
ms.date: 05/02/2022
10+
---
11+
12+
# Quickstart: Use Bicep to create an Azure Database for MySQL server
13+
14+
[!INCLUDE[applies-to-mysql-single-server](includes/applies-to-mysql-single-server.md)]
15+
16+
Azure Database for MySQL is a managed service that you use to run, manage, and scale highly available MySQL databases in the cloud. In this quickstart, you use Bicep to create an Azure Database for MySQL server with virtual network integration. You can create the server in the Azure portal, Azure CLI, or Azure PowerShell.
17+
18+
[!INCLUDE [About Bicep](../../includes/resource-manager-quickstart-bicep-introduction.md)]
19+
20+
## Prerequisites
21+
22+
You need an Azure account with an active subscription. [Create one for free](https://azure.microsoft.com/free/).
23+
24+
# [PowerShell](#tab/PowerShell)
25+
26+
* If you want to run the code locally, [Azure PowerShell](/powershell/azure/).
27+
28+
# [CLI](#tab/CLI)
29+
30+
* If you want to run the code locally, [Azure CLI](/cli/azure/).
31+
32+
---
33+
34+
## Review the Bicep file
35+
36+
You create an Azure Database for MySQL server with a defined set of compute and storage resources. To learn more, see [Azure Database for MySQL pricing tiers](concepts-pricing-tiers.md). You create the server within an [Azure resource group](../azure-resource-manager/management/overview.md).
37+
38+
The Bicep file used in this quickstart is from [Azure Quickstart Templates](https://azure.microsoft.com/resources/templates/managed-mysql-with-vnet/).
39+
40+
:::code language="bicep" source="~/quickstart-templates/quickstarts/microsoft.dbformysql/managed-mysql-with-vnet/main.bicep":::
41+
42+
The Bicep file defines five Azure resources:
43+
44+
* [**Microsoft.Network/virtualNetworks**](/azure/templates/microsoft.network/virtualnetworks)
45+
* [**Microsoft.Network/virtualNetworks/subnets**](/azure/templates/microsoft.network/virtualnetworks/subnets)
46+
* [**Microsoft.DBforMySQL/servers**](/azure/templates/microsoft.dbformysql/servers)
47+
* [**Microsoft.DBforMySQL/servers/virtualNetworkRules**](/azure/templates/microsoft.dbformysql/servers/virtualnetworkrules)
48+
* [**Microsoft.DBforMySQL/servers/firewallRules**](/azure/templates/microsoft.dbformysql/servers/firewallrules)
49+
50+
## Deploy the Bicep file
51+
52+
53+
1. Save the Bicep file as **main.bicep** to your local computer.
54+
1. Deploy the Bicep file using either Azure CLI or Azure PowerShell.
55+
56+
# [CLI](#tab/CLI)
57+
58+
```azurecli
59+
az group create --name exampleRG --location eastus
60+
az deployment group create --resource-group exampleRG --template-file main.bicep --parameters serverName=<server-name> administratorLogin=<admin-login>
61+
```
62+
63+
# [PowerShell](#tab/PowerShell)
64+
65+
```azurepowershell
66+
New-AzResourceGroup -Name exampleRG -Location eastus
67+
New-AzResourceGroupDeployment -ResourceGroupName exampleRG -TemplateFile ./main.bicep -serverName "<server-name>" -administratorLogin "<admin-login>"
68+
```
69+
70+
---
71+
72+
> [!NOTE]
73+
> Replace **\<server-name\>** with the server name for Azure database for MySQL. Replace **\<admin-login\>** with the database administrator login name. You'll also be prompted to enter **administratorLoginPassword**. The minimum password length is eight characters.
74+
75+
When the deployment finishes, you should see a message indicating the deployment succeeded.
76+
77+
## Review deployed resources
78+
79+
Use the Azure portal, Azure CLI, or Azure PowerShell to list the deployed resources in the resource group.
80+
81+
# [CLI](#tab/CLI)
82+
83+
```azurecli-interactive
84+
az resource list --resource-group exampleRG
85+
```
86+
87+
# [PowerShell](#tab/PowerShell)
88+
89+
```azurepowershell-interactive
90+
Get-AzResource -ResourceGroupName exampleRG
91+
```
92+
93+
---
94+
95+
## Clean up resources
96+
97+
When no longer needed, use the Azure portal, Azure CLI, or Azure PowerShell to delete the resource group and its resources.
98+
99+
# [CLI](#tab/CLI)
100+
101+
```azurecli-interactive
102+
az group delete --name exampleRG
103+
```
104+
105+
# [PowerShell](#tab/PowerShell)
106+
107+
```azurepowershell-interactive
108+
Remove-AzResourceGroup -Name exampleRG
109+
```
110+
111+
---
112+
113+
## Next steps
114+
115+
For a step-by-step tutorial that guides you through the process of creating a Bicep file with Visual Studio Code, see:
116+
117+
> [!div class="nextstepaction"]
118+
> [Quickstart: Create Bicep files with Visual Studio Code](../azure-resource-manager/bicep/quickstart-create-bicep-use-visual-studio-code.md)

0 commit comments

Comments
 (0)