You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/mariadb/howto-manage-vnet-cli.md
+14-81Lines changed: 14 additions & 81 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,20 +19,12 @@ Virtual Network (VNet) services endpoints and rules extend the private address s
19
19
20
20
- You need an [Azure Database for MariaDB server and database](quickstart-create-mariadb-server-database-using-azure-cli.md).
21
21
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
-
24
22
> [!NOTE]
25
23
> Support for VNet service endpoints is only for General Purpose and Memory Optimized servers.
26
24
27
25
## Configure VNet service endpoints
28
26
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.
36
28
37
29
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.
38
30
@@ -43,82 +35,23 @@ VNets and Azure service resources can be in the same or different subscriptions.
43
35
> [!IMPORTANT]
44
36
> 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.
45
37
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.")]
The following table includes links to sample Azure CLI scripts for Azure Database for MariaDB.
15
24
16
-
| Sample link | Description |
25
+
| Sample link | Description |
17
26
|---|---|
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. |
20
30
|**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. |
22
32
|**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. |
24
34
|**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. |
26
36
|**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. |
Copy file name to clipboardExpand all lines: articles/mariadb/scripts/sample-change-server-configuration.md
+19-6Lines changed: 19 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,23 +7,35 @@ ms.service: mariadb
7
7
ms.devlang: azurecli
8
8
ms.topic: sample
9
9
ms.custom: mvc, devx-track-azurecli
10
-
ms.date: 12/02/2019
10
+
ms.date: 01/11/2022
11
11
---
12
12
13
13
# List and update configurations of an Azure Database for MariaDB server using Azure CLI
14
+
14
15
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.
- This article requires version 2.0 or later of the Azure CLI. If using Azure Cloud Shell, the latest version is already installed.
21
-
22
21
## 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.")]
Copy file name to clipboardExpand all lines: articles/mariadb/scripts/sample-create-server-and-firewall-rule.md
+19-6Lines changed: 19 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,23 +7,35 @@ ms.service: mariadb
7
7
ms.devlang: azurecli
8
8
ms.topic: sample
9
9
ms.custom: mvc, devx-track-azurecli
10
-
ms.date: 11/28/2018
10
+
ms.date: 01/11/2022
11
11
---
12
12
13
13
# Create a MariaDB server and configure a firewall rule using the Azure CLI
14
+
14
15
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.
- This article requires version 2.0 or later of the Azure CLI. If using Azure Cloud Shell, the latest version is already installed.
21
-
22
21
## 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.")]
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.
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).
- This article requires version 2.0 or later of the Azure CLI. If using Azure Cloud Shell, the latest version is already installed.
21
-
22
21
## 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.")]
0 commit comments