Skip to content

Commit 60a7fdb

Browse files
authored
Merge pull request #184787 from carlrab/azurecli_mariadb
updated parents and added parents and TOC
2 parents 1c56461 + b1a49a1 commit 60a7fdb

10 files changed

+202
-125
lines changed

articles/mariadb/TOC.yml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,6 @@
6363
href: tutorial-design-database-cli.md
6464
- name: Azure PowerShell
6565
href: tutorial-design-database-using-powershell.md
66-
- name: Samples
67-
items:
68-
- name: Azure CLI
69-
href: sample-scripts-azure-cli.md
7066
- name: Drivers and tools compatibility
7167
href: concepts-compatibility.md
7268
- name: Connection resiliency
@@ -228,6 +224,24 @@
228224
href: howto-troubleshoot-common-connection-issues.md
229225
- name: Troubleshoot query performance
230226
href: howto-troubleshoot-query-performance.md
227+
- name: Samples
228+
items:
229+
- name: Azure CLI Samples
230+
items:
231+
- name: Samples overview
232+
href: sample-scripts-azure-cli.md
233+
- name: Create a server with firewall rule
234+
href: ./scripts/sample-create-server-and-firewall-rule.md
235+
- name: Create server with vNet rule
236+
href: ./scripts/sample-create-server-with-vnet-rule.md
237+
- name: Scale a server
238+
href: ./scripts/sample-scale-server.md
239+
- name: Change server configurations
240+
href: ./scripts/sample-change-server-configuration.md
241+
- name: Restore a server
242+
href: ./scripts/sample-point-in-time-restore.md
243+
- name: Manipulate with server logs
244+
href: ./scripts/sample-server-logs.md
231245
- name: Reference
232246
items:
233247
- name: Azure CLI

articles/mariadb/howto-manage-vnet-cli.md

Lines changed: 14 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,12 @@ Virtual Network (VNet) services endpoints and rules extend the private address s
1919

2020
- You need an [Azure Database for MariaDB server and database](quickstart-create-mariadb-server-database-using-azure-cli.md).
2121

22-
- This article requires version 2.0 or later of the Azure CLI. If using Azure Cloud Shell, the latest version is already installed.
23-
2422
> [!NOTE]
2523
> Support for VNet service endpoints is only for General Purpose and Memory Optimized servers.
2624
2725
## Configure VNet service endpoints
2826

29-
The [az network vnet](/cli/azure/network/vnet) commands are used to configure Virtual Networks.
30-
31-
If you have multiple subscriptions, choose the appropriate subscription in which the resource should be billed. Select the specific subscription ID under your account using [az account set](/cli/azure/account#az_account_set) command. Substitute the **id** property from the **az login** output for your subscription into the subscription id placeholder.
32-
33-
- The account must have the necessary permissions to create a virtual network and service endpoint.
34-
35-
Service endpoints can be configured on virtual networks independently, by a user with write access to the virtual network.
27+
The [az network vnet](/cli/azure/network/vnet) commands are used to configure Virtual Networks. Service endpoints can be configured on virtual networks independently, by a user with write access to the virtual network.
3628

3729
To secure Azure service resources to a VNet, the user must have permission to "Microsoft.Network/virtualNetworks/subnets/joinViaServiceEndpoint/" for the subnets being added. This permission is included in the built-in service administrator roles, by default and can be modified by creating custom roles.
3830

@@ -43,82 +35,23 @@ VNets and Azure service resources can be in the same or different subscriptions.
4335
> [!IMPORTANT]
4436
> It is highly recommended to read this article about service endpoint configurations and considerations before configuring service endpoints. **Virtual Network service endpoint:** A [Virtual Network service endpoint](../virtual-network/virtual-network-service-endpoints-overview.md) is a subnet whose property values include one or more formal Azure service type names. VNet services endpoints use the service type name **Microsoft.Sql**, which refers to the Azure service named SQL Database. This service tag also applies to the Azure SQL Database, Azure Database for MariaDB, PostgreSQL, and MySQL services. It is important to note when applying the **Microsoft.Sql** service tag to a VNet service endpoint it configures service endpoint traffic for all Azure Database services, including Azure SQL Database, Azure Database for PostgreSQL, Azure Database for MariaDB, and Azure Database for MySQL servers on the subnet.
4537
46-
### Sample script
47-
48-
This sample script is used to create an Azure Database for MariaDB server, create a VNet, VNet service endpoint and secure the server to the subnet with a VNet rule. In this sample script, change the admin username and password. Replace the SubscriptionID used in the `az account set --subscription` command with your own subscription identifier.
49-
50-
```azurecli-interactive
51-
# To find the name of an Azure region in the CLI run this command: az account list-locations
52-
# Substitute <subscription id> with your identifier
53-
az account set --subscription <subscription id>
54-
55-
# Create a resource group
56-
az group create \
57-
--name myresourcegroup \
58-
--location westus
59-
60-
# Create a MariaDB server in the resource group
61-
# Name of a server maps to DNS name and is thus required to be globally unique in Azure.
62-
# Substitute the <server_admin_password> with your own value.
63-
az mariadb server create \
64-
--name mydemoserver \
65-
--resource-group myresourcegroup \
66-
--location westus \
67-
--admin-user mylogin \
68-
--admin-password <server_admin_password> \
69-
--sku-name GP_Gen5_2
70-
71-
# Get available service endpoints for Azure region output is JSON
72-
# Use the command below to get the list of services supported for endpoints, for an Azure region, say "westus".
73-
az network vnet list-endpoint-services \
74-
-l westus
75-
76-
# Add Azure SQL service endpoint to a subnet *mySubnet* while creating the virtual network *myVNet* output is JSON
77-
az network vnet create \
78-
-g myresourcegroup \
79-
-n myVNet \
80-
--address-prefixes 10.0.0.0/16 \
81-
-l westus
82-
83-
# Creates the service endpoint
84-
az network vnet subnet create \
85-
-g myresourcegroup \
86-
-n mySubnet \
87-
--vnet-name myVNet \
88-
--address-prefix 10.0.1.0/24 \
89-
--service-endpoints Microsoft.SQL
90-
91-
# View service endpoints configured on a subnet
92-
az network vnet subnet show \
93-
-g myresourcegroup \
94-
-n mySubnet \
95-
--vnet-name myVNet
96-
97-
# Create a VNet rule on the sever to secure it to the subnet Note: resource group (-g) parameter is where the database exists. VNet resource group if different should be specified using subnet id (URI) instead of subnet, VNet pair.
98-
az mariadb server vnet-rule create \
99-
-n myRule \
100-
-g myresourcegroup \
101-
-s mydemoserver \
102-
--vnet-name myVNet \
103-
--subnet mySubnet
104-
```
105-
106-
<!--
107-
In this sample script, change the highlighted lines to customize the admin username and password. Replace the SubscriptionID used in the `az account set --subscription` command with your own subscription identifier.
108-
[!code-azurecli-interactive[main](../../cli_scripts/mariadb/create-mysql-server-vnet/create-mysql-server.sh?highlight=5,20 "Create an Azure Database for MariaDB, VNet, VNet service endpoint, and VNet rule.")]
109-
-->
38+
## Sample script
39+
40+
[!INCLUDE [cli-launch-cloud-shell-sign-in.md](../../includes/cli-launch-cloud-shell-sign-in.md)]
41+
42+
### Run the script
43+
44+
:::code language="azurecli" source="~/azure_cli_scripts/mariadb/create-mariadb-server-vnet/create-mariadb-server.sh" range="4-50":::
11045

11146
## Clean up deployment
112-
After the script sample has been run, the following command can be used to remove the resource group and all resources associated with it.
11347

114-
```azurecli-interactive
115-
az group delete --name myresourcegroup
116-
```
48+
[!INCLUDE [cli-clean-up-resources.md](../../includes/cli-clean-up-resources.md)]
11749

50+
```azurecli
51+
echo "Cleaning up resources by removing the resource group..."
52+
az group delete --name $resourceGroup -y
11853
119-
<!--
120-
[!code-azurecli-interactive[main](../../cli_scripts/mysql/create-mysql-server-vnet/delete-mysql.sh "Delete the resource group.")]
121-
-->
54+
```
12255

123-
<!-- Link references, to text, Within this same GitHub repo. -->
56+
<!-- Link references, to text, Within this same GitHub repo. -->
12457
[resource-manager-portal]: ../azure-resource-manager/management/resource-providers-and-types.md

articles/mariadb/sample-scripts-azure-cli.md

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,32 @@ ms.service: mariadb
77
ms.devlang: azurecli
88
ms.topic: sample
99
ms.custom: mvc, devx-track-, seo-azure-cli
10-
ms.date: 09/17/2021
10+
ms.date: 01/11/2022
1111
Keywords: azure cli samples, azure cli code samples, azure cli script samples
1212
---
13-
# Azure CLI samples for Azure Database for MariaDB
13+
# Azure CLI samples for Azure Database for MariaDB
14+
15+
You can configure Azure SQL Database for MariaDB by using the <a href="/cli/azure">Azure CLI</a>.
16+
17+
[!INCLUDE [quickstarts-free-trial-note](../../includes/quickstarts-free-trial-note.md)]
18+
19+
[!INCLUDE [azure-cli-prepare-your-environment.md](../../includes/azure-cli-prepare-your-environment.md)]
20+
21+
## Samples
22+
1423
The following table includes links to sample Azure CLI scripts for Azure Database for MariaDB.
1524

16-
| Sample link | Description |
25+
| Sample link | Description |
1726
|---|---|
18-
|**Create a server**||
19-
| [Create a server and firewall rule](./scripts/sample-create-server-and-firewall-rule.md?toc=%2fcli%2fazure%2ftoc.json) | Azure CLI script that creates a single Azure Database for MariaDB server and configures a server-level firewall rule. |
27+
|**Create a server with firewall rule**||
28+
| [Create a server and firewall rule](./scripts/sample-create-server-and-firewall-rule.md) | Azure CLI script that creates a single Azure Database for MariaDB server and configures a server-level firewall rule. |
29+
| [Create script with vNet rules](./scripts/sample-create-server-with-vnet-rule.md) | Azure CLI that creates an Azure Database for MariaDB server with a service endpoint on a virtual network and configures a vNet rule. |
2030
|**Scale a server**||
21-
| [Scale a server](./scripts/sample-scale-server.md?toc=%2fcli%2fazure%2ftoc.json) | Azure CLI script that scales a single Azure Database for MariaDB server up or down to allow for changing performance needs. |
31+
| [Scale a server](./scripts/sample-scale-server.md) | Azure CLI script that scales a single Azure Database for MariaDB server up or down to allow for changing performance needs. |
2232
|**Change server configurations**||
23-
| [Change server configurations](./scripts/sample-change-server-configuration.md?toc=%2fcli%2fazure%2ftoc.json) | Azure CLI script that change configurations of a single Azure Database for MariaDB server. |
33+
| [Change server configurations](./scripts/sample-change-server-configuration.md) | Azure CLI script that change configurations of a single Azure Database for MariaDB server. |
2434
|**Restore a server**||
25-
| [Restore a server](./scripts/sample-point-in-time-restore.md?toc=%2fcli%2fazure%2ftoc.json) | Azure CLI script that restores a single Azure Database for MariaDB server to a previous point in time. |
35+
| [Restore a server](./scripts/sample-point-in-time-restore.md) | Azure CLI script that restores a single Azure Database for MariaDB server to a previous point in time. |
2636
|**Manipulate with server logs**||
27-
| [Enable and download server logs](./scripts/sample-server-logs.md?toc=%2fcli%2fazure%2ftoc.json) | Azure CLI script that enables and downloads server logs of a single Azure Database for MariaDB server. |
37+
| [Enable server logs](./scripts/sample-server-logs.md) | Azure CLI script that enables server logs of a single Azure Database for MariaDB server. |
2838
|||

articles/mariadb/scripts/sample-change-server-configuration.md

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,35 @@ ms.service: mariadb
77
ms.devlang: azurecli
88
ms.topic: sample
99
ms.custom: mvc, devx-track-azurecli
10-
ms.date: 12/02/2019
10+
ms.date: 01/11/2022
1111
---
1212

1313
# List and update configurations of an Azure Database for MariaDB server using Azure CLI
14+
1415
This sample CLI script lists all available configuration parameters as well as their allowable values for Azure Database for MariaDB server, and sets the *innodb_lock_wait_timeout* to a value that is other than the default one.
1516

1617
[!INCLUDE [quickstarts-free-trial-note](../../../includes/quickstarts-free-trial-note.md)]
1718

1819
[!INCLUDE [azure-cli-prepare-your-environment.md](../../../includes/azure-cli-prepare-your-environment.md)]
1920

20-
- This article requires version 2.0 or later of the Azure CLI. If using Azure Cloud Shell, the latest version is already installed.
21-
2221
## Sample script
23-
In this sample script, edit the highlighted lines to update the admin username and password to your own.
24-
[!code-azurecli-interactive[main](../../../cli_scripts/mariadb/change-server-configurations/change-server-configurations.sh?highlight=15-16 "List and update configurations of Azure Database for MariaDB.")]
2522

26-
## Script explanation
23+
[!INCLUDE [cli-launch-cloud-shell-sign-in.md](../../../includes/cli-launch-cloud-shell-sign-in.md)]
24+
25+
### Run the script
26+
27+
:::code language="azurecli" source="~/azure_cli_scripts/mariadb/change-server-configurations/change-server-configurations.sh" range="4-34":::
28+
29+
## Clean up resources
30+
31+
[!INCLUDE [cli-clean-up-resources.md](../../../includes/cli-clean-up-resources.md)]
32+
33+
```azurecli
34+
az group delete --name $resourceGroup
35+
```
36+
37+
## Sample reference
38+
2739
This script uses the commands outlined in the following table:
2840

2941
| **Command** | **Notes** |
@@ -36,6 +48,7 @@ This script uses the commands outlined in the following table:
3648
| [az group delete](/cli/azure/group#az_group_delete) | Deletes a resource group including all nested resources. |
3749

3850
## Next steps
51+
3952
- Read more information on the Azure CLI: [Azure CLI documentation](/cli/azure).
4053
- Try additional scripts: [Azure CLI samples for Azure Database for MariaDB](../sample-scripts-azure-cli.md)
4154
- For more information on server parameters, see [How To Configure Server Parameters in Azure Database for MariaDB](../howto-server-parameters.md).

articles/mariadb/scripts/sample-create-server-and-firewall-rule.md

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,35 @@ ms.service: mariadb
77
ms.devlang: azurecli
88
ms.topic: sample
99
ms.custom: mvc, devx-track-azurecli
10-
ms.date: 11/28/2018
10+
ms.date: 01/11/2022
1111
---
1212

1313
# Create a MariaDB server and configure a firewall rule using the Azure CLI
14+
1415
This sample CLI script creates an Azure Database for MariaDB server and configures a server-level firewall rule. Once the script runs successfully, the MariaDB server is accessible by all Azure services and the configured IP address.
1516

1617
[!INCLUDE [quickstarts-free-trial-note](../../../includes/quickstarts-free-trial-note.md)]
1718

1819
[!INCLUDE [azure-cli-prepare-your-environment.md](../../../includes/azure-cli-prepare-your-environment.md)]
1920

20-
- This article requires version 2.0 or later of the Azure CLI. If using Azure Cloud Shell, the latest version is already installed.
21-
2221
## Sample script
23-
In this sample script, edit the highlighted lines to update the admin username and password to your own.
24-
[!code-azurecli-interactive[main](../../../cli_scripts/mariadb/create-mariadb-server-and-firewall-rule/create-mariadb-server-and-firewall-rule.sh?highlight=15-16 "Create an Azure Database for mariadb, and server-level firewall rule.")]
2522

26-
## Script explanation
23+
[!INCLUDE [cli-launch-cloud-shell-sign-in.md](../../../includes/cli-launch-cloud-shell-sign-in.md)]
24+
25+
### Run the script
26+
27+
:::code language="azurecli" source="~/azure_cli_scripts/mariadb/create-mariadb-server-and-firewall-rule/create-mariadb-server-and-firewall-rule.sh" range="4-31":::
28+
29+
## Clean up resources
30+
31+
[!INCLUDE [cli-clean-up-resources.md](../../../includes/cli-clean-up-resources.md)]
32+
33+
```azurecli
34+
az group delete --name $resourceGroup
35+
```
36+
37+
## Sample reference
38+
2739
This script uses the commands outlined in the following table:
2840

2941
| **Command** | **Notes** |
@@ -34,5 +46,6 @@ This script uses the commands outlined in the following table:
3446
| [az group delete](/cli/azure/group#az_group_delete) | Deletes a resource group including all nested resources. |
3547

3648
## Next steps
49+
3750
- Read more information on the Azure CLI: [Azure CLI documentation](/cli/azure).
3851
- Try additional scripts: [Azure CLI samples for Azure Database for MariaDB](../sample-scripts-azure-cli.md)
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
title: CLI script - Create server with vNet rule - Azure Database for MariaDB
3+
description: This sample CLI script creates an Azure Database for MariaDB server with a service endpoint on a virtual network and configures a vNet rule.
4+
author: savjani
5+
ms.author: pariks
6+
ms.service: mariadb
7+
ms.devlang: azurecli
8+
ms.topic: sample
9+
ms.custom: mvc, devx-track-azurecli
10+
ms.date: 01/11/2022
11+
---
12+
13+
# Create a MariaDB server and configure a vNet rule using the Azure CLI
14+
15+
This sample CLI script creates an Azure Database for MariaDB server and configures a vNet rule.
16+
17+
[!INCLUDE [quickstarts-free-trial-note](../../../includes/quickstarts-free-trial-note.md)]
18+
19+
[!INCLUDE [azure-cli-prepare-your-environment.md](../../../includes/azure-cli-prepare-your-environment.md)]
20+
21+
## Sample script
22+
23+
[!INCLUDE [cli-launch-cloud-shell-sign-in.md](../../../includes/cli-launch-cloud-shell-sign-in.md)]
24+
25+
### Run the script
26+
27+
:::code language="azurecli" source="~/azure_cli_scripts/mariadb/create-mariadb-server-vnet/create-mariadb-server.sh" range="4-50":::
28+
29+
## Clean up resources
30+
31+
[!INCLUDE [cli-clean-up-resources.md](../../../includes/cli-clean-up-resources.md)]
32+
33+
```azurecli
34+
az group delete --name $resourceGroup
35+
```
36+
37+
## Sample reference
38+
39+
This script uses the commands outlined in the following table:
40+
41+
| **Command** | **Notes** |
42+
|---|---|
43+
| [az group create](/cli/azure/group#az_group_create) | Creates a resource group in which all resources are stored. |
44+
| [az mariadb server create](/cli/azure/mariadb/server#az_mariadb_server_create) | Creates a MariaDB server that hosts the databases. |
45+
| [az network vnet list-endpoint-services](/cli/cli/azure/network/vnet#az-network-vnet-list-endpoint-services) | List which services support VNET service tunneling in a given region. |
46+
| [az network vnet create](/cli/azure/network/vnet#az-network-vnet-create) | Creates a virtual network. |
47+
| [az network vnet subnet create](/cli/azure/network/vnet#az-network-vnet-subnet-create) | Create a subnet and associate an existing NSG and route table. |
48+
| [az network vnet subnet show](/cli/azure/network/vnet#az-network-vnet-subnet-show) | Shows details of a subnet. |
49+
| [az mariadb server vnet-rule create](/cli/azure/mariadb/server/vnet-rule#az-mariadb-server-vnet-rule-create) | Create a virtual network rule to allows access to a MariaDB server. |
50+
| [az group delete](/cli/azure/group#az_group_delete) | Deletes a resource group including all nested resources. |
51+
52+
## Next steps
53+
54+
- Read more information on the Azure CLI: [Azure CLI documentation](/cli/azure).
55+
- Try additional scripts: [Azure CLI samples for Azure Database for MariaDB](../sample-scripts-azure-cli.md).

articles/mariadb/scripts/sample-point-in-time-restore.md

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,35 @@ ms.service: mariadb
77
ms.devlang: azurecli
88
ms.topic: sample
99
ms.custom: mvc, devx-track-azurecli
10-
ms.date: 12/02/2019
10+
ms.date: 01/11/2022
1111
---
1212

1313
# Restore an Azure Database for MariaDB server using Azure CLI
14+
1415
This sample CLI script restores a single Azure Database for MariaDB server to a previous point in time.
1516

1617
[!INCLUDE [quickstarts-free-trial-note](../../../includes/quickstarts-free-trial-note.md)]
1718

1819
[!INCLUDE [azure-cli-prepare-your-environment.md](../../../includes/azure-cli-prepare-your-environment.md)]
1920

20-
- This article requires version 2.0 or later of the Azure CLI. If using Azure Cloud Shell, the latest version is already installed.
21-
2221
## Sample script
23-
In this sample script, edit the highlighted lines to update the admin username and password to your own. Replace the subscription ID used in the `az monitor` commands with your own subscription ID.
24-
[!code-azurecli-interactive[main](../../../cli_scripts/mariadb/backup-restore-pitr/backup-restore.sh?highlight=15-16 "Restore Azure Database for MariaDB.")]
2522

26-
## Script explanation
23+
[!INCLUDE [cli-run-local-sign-in.md](../../../includes/cli-run-local-sign-in.md)]
24+
25+
### Run the script
26+
27+
:::code language="azurecli" source="~/azure_cli_scripts/mariadb/backup-restore-pitr/backup-restore.sh" range="6-38":::
28+
29+
## Clean up resources
30+
31+
[!INCLUDE [cli-clean-up-resources.md](../../../includes/cli-clean-up-resources.md)]
32+
33+
```azurecli
34+
az group delete --name $resourceGroup
35+
```
36+
37+
## Sample reference
38+
2739
This script uses the commands outlined in the following table:
2840

2941
| **Command** | **Notes** |
@@ -34,5 +46,6 @@ This script uses the commands outlined in the following table:
3446
| [az group delete](/cli/azure/group#az_group_delete) | Deletes a resource group including all nested resources. |
3547

3648
## Next steps
49+
3750
- Read more information on the Azure CLI: [Azure CLI documentation](/cli/azure).
3851
- Try additional scripts: [Azure CLI samples for Azure Database for MariaDB](../sample-scripts-azure-cli.md)

0 commit comments

Comments
 (0)