Skip to content

Commit c939a03

Browse files
authored
Merge pull request #113271 from mikefrobbins/mr-mysql-pwsh
Added MySQL PowerShell docs and updated TOC
2 parents 084e176 + c59a989 commit c939a03

8 files changed

+476
-7
lines changed

articles/mysql/TOC.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747
href: tutorial-design-database-using-portal.md
4848
- name: Azure CLI
4949
href: tutorial-design-database-using-cli.md
50+
- name: Azure PowerShell
51+
href: tutorial-design-database-using-powershell.md
5052
- name: Azure Resource Manager template
5153
href: tutorial-provision-mysql-server-using-Azure-Resource-Manager-templates.md
5254
- name: 2 - Create a Web App
@@ -192,6 +194,8 @@
192194
href: howto-server-parameters.md
193195
- name: Azure CLI
194196
href: howto-configure-server-parameters-using-cli.md
197+
- name: Azure PowerShell
198+
href: howto-configure-server-parameters-using-powershell.md
195199
- name: Auto grow storage
196200
items:
197201
- name: Azure portal
@@ -226,6 +230,8 @@
226230
href: howto-read-replicas-portal.md
227231
- name: Create read replicas Azure CLI, REST API
228232
href: howto-read-replicas-cli.md
233+
- name: Create read replicas Azure PowerShell
234+
href: howto-read-replicas-powershell.md
229235
- name: Troubleshoot
230236
items:
231237
- name: Troubleshoot connection errors

articles/mysql/howto-auto-grow-storage-powershell.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ms.service: mysql
77
ms.topic: conceptual
88
ms.date: 4/28/2020
99
---
10-
# Auto grow storage in Azure Database for MySQL storage using PowerShell
10+
# Auto grow storage in Azure Database for MySQL server using PowerShell
1111

1212
This article describes how you can configure an Azure Database for MySQL server storage to grow
1313
without impacting the workload.
@@ -57,4 +57,5 @@ New-AzMySqlServer -Name mydemoserver -ResourceGroupName myresourcegroup -Sku GP_
5757

5858
## Next steps
5959

60-
Learn about [how to create alerts on metrics](howto-alert-on-metric.md).
60+
> [!div class="nextstepaction"]
61+
> [How to create and manage read replicas in Azure Database for MySQL using PowerShell](howto-read-replicas-powershell.md).
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
---
2+
title: Configure server parameters - Azure PowerShell - Azure Database for MySQL
3+
description: This article describes how to configure the service parameters in Azure Database for MySQL using PowerShell.
4+
author: ajlam
5+
ms.author: andrela
6+
ms.service: mysql
7+
ms.devlang: azurepowershell
8+
ms.topic: conceptual
9+
ms.date: 4/29/2020
10+
---
11+
12+
# Customize Azure Database for MySQL server parameters using PowerShell
13+
14+
You can list, show, and update configuration parameters for an Azure Database for MySQL server using
15+
PowerShell. A subset of engine configurations is exposed at the server-level and can be modified.
16+
17+
## Prerequisites
18+
19+
To complete this how-to guide, you need:
20+
21+
- The [Az PowerShell module](/powershell/azure/install-az-ps) installed locally or
22+
[Azure Cloud Shell](https://shell.azure.com/) in the browser
23+
- An [Azure Database for MySQL server](quickstart-create-mysql-server-database-using-azure-powershell.md)
24+
25+
> [!IMPORTANT]
26+
> While the Az.MySql PowerShell module is in preview, you must install it separately from the Az
27+
> PowerShell module using the following command: `Install-Module -Name Az.MySql -AllowPrerelease`.
28+
> Once the Az.MySql PowerShell module is generally available, it becomes part of future Az
29+
> PowerShell module releases and available natively from within Azure Cloud Shell.
30+
31+
If you choose to use PowerShell locally, connect to your Azure account using the
32+
[Connect-AzAccount](/powershell/module/az.accounts/Connect-AzAccount) cmdlet.
33+
34+
[!INCLUDE [cloud-shell-try-it.md](../../includes/cloud-shell-try-it.md)]
35+
36+
## List server configuration parameters for Azure Database for MySQL server
37+
38+
To list all modifiable parameters in a server and their values, run the `Get-AzMySqlConfiguration`
39+
cmdlet.
40+
41+
The following example lists the server configuration parameters for the server **mydemoserver** in
42+
resource group **myresourcegroup**.
43+
44+
```azurepowershell-interactive
45+
Get-AzMySqlConfiguration -ResourceGroupName myresourcegroup -ServerName mydemoserver
46+
```
47+
48+
For the definition of each of the listed parameters, see the MySQL reference section on
49+
[Server System Variables](https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html).
50+
51+
## Show server configuration parameter details
52+
53+
To show details about a particular configuration parameter for a server, run the
54+
`Get-AzMySqlConfiguration` cmdlet and specify the **Name** parameter.
55+
56+
This example shows details of the **slow\_query\_log** server configuration parameter for server
57+
**mydemoserver** under resource group **myresourcegroup**.
58+
59+
```azurepowershell-interactive
60+
Get-AzMySqlConfiguration -Name slow_query_log -ResourceGroupName myresourcegroup -ServerName mydemoserver
61+
```
62+
63+
## Modify a server configuration parameter value
64+
65+
You can also modify the value of a certain server configuration parameter, which updates the
66+
underlying configuration value for the MySQL server engine. To update the configuration, use the
67+
`Update-AzMySqlConfiguration` cmdlet.
68+
69+
To update the **slow\_query\_log** server configuration parameter of server
70+
**mydemoserver** under resource group **myresourcegroup**.
71+
72+
```azurepowershell-interactive
73+
Update-AzMySqlConfiguration -Name slow_query_log -ResourceGroupName myresourcegroup -ServerName mydemoserver -Value On
74+
```
75+
76+
## Next steps
77+
78+
> [!div class="nextstepaction"]
79+
> [Auto grow storage in Azure Database for MySQL server using PowerShell](howto-auto-grow-storage-powershell.md).
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
---
2+
title: Manage read replicas - Azure PowerShell - Azure Database for MySQL
3+
description: Learn how to set up and manage read replicas in Azure Database for MySQL using PowerShell.
4+
author: ajlam
5+
ms.author: andrela
6+
ms.service: mysql
7+
ms.topic: conceptual
8+
ms.date: 4/29/2020
9+
---
10+
11+
# How to create and manage read replicas in Azure Database for MySQL using PowerShell
12+
13+
In this article, you learn how to create and manage read replicas in the Azure Database for MySQL
14+
service using PowerShell. To learn more about read replicas, see the
15+
[overview](concepts-read-replicas.md).
16+
17+
## Azure PowerShell
18+
19+
You can create and manage read replicas using PowerShell.
20+
21+
## Prerequisites
22+
23+
To complete this how-to guide, you need:
24+
25+
- The [Az PowerShell module](/powershell/azure/install-az-ps) installed locally or
26+
[Azure Cloud Shell](https://shell.azure.com/) in the browser
27+
- An [Azure Database for MySQL server](quickstart-create-mysql-server-database-using-azure-powershell.md)
28+
29+
> [!IMPORTANT]
30+
> While the Az.MySql PowerShell module is in preview, you must install it separately from the Az
31+
> PowerShell module using the following command: `Install-Module -Name Az.MySql -AllowPrerelease`.
32+
> Once the Az.MySql PowerShell module is generally available, it becomes part of future Az
33+
> PowerShell module releases and available natively from within Azure Cloud Shell.
34+
35+
If you choose to use PowerShell locally, connect to your Azure account using the
36+
[Connect-AzAccount](/powershell/module/az.accounts/Connect-AzAccount) cmdlet.
37+
38+
[!INCLUDE [cloud-shell-try-it.md](../../includes/cloud-shell-try-it.md)]
39+
40+
> [!IMPORTANT]
41+
> The read replica feature is only available for Azure Database for MySQL servers in the General
42+
> Purpose or Memory Optimized pricing tiers. Ensure the master server is in one of these pricing
43+
> tiers.
44+
45+
### Create a read replica
46+
47+
A read replica server can be created using the following command:
48+
49+
```azurepowershell-interactive
50+
Get-AzMySqlServer -Name mydemoserver -ResourceGroupName myresourcegroup |
51+
New-AzMySqlServerReplica -Name mydemoreplicaserver -ResourceGroupName myresourcegroup
52+
```
53+
54+
The `New-AzMySqlServerReplica` command requires the following parameters:
55+
56+
| Setting | Example value | Description  |
57+
| --- | --- | --- |
58+
| ResourceGroupName |  myresourcegroup |  The resource group where the replica server is created.  |
59+
| Name | mydemoreplicaserver | The name of the new replica server that is created. |
60+
61+
To create a cross region read replica, use the **Location** parameter. The following example creates
62+
a replica in the **West US** region.
63+
64+
```azurepowershell-interactive
65+
Get-AzMySqlServer -Name mrdemoserver -ResourceGroupName myresourcegroup |
66+
New-AzMySqlServerReplica -Name mydemoreplicaserver -ResourceGroupName myresourcegroup -Location westus
67+
```
68+
69+
To learn more about which regions you can create a replica in, visit the
70+
[read replica concepts article](concepts-read-replicas.md).
71+
72+
By default, read replicas are created with the same server configuration as the master unless the
73+
**Sku** parameter is specified.
74+
75+
> [!NOTE]
76+
> It is recommended that the replica server's configuration should be kept at equal or greater
77+
> values than the master to ensure the replica is able to keep up with the master.
78+
79+
### List replicas for a master server
80+
81+
To view all replicas for a given master server, run the following command:
82+
83+
```azurepowershell-interactive
84+
Get-AzMySqlReplica -ResourceGroupName myresourcegroup -ServerName mydemoserver
85+
```
86+
87+
The `Get-AzMySqlReplica` command requires the following parameters:
88+
89+
| Setting | Example value | Description  |
90+
| --- | --- | --- |
91+
| ResourceGroupName |  myresourcegroup |  The resource group where the replica server will be created to.  |
92+
| ServerName | mydemoserver | The name or ID of the master server. |
93+
94+
### Delete a replica server
95+
96+
Deleting a read replica server can be done by running the `Remove-AzMySqlServer` cmdlet.
97+
98+
```azurepowershell-interactive
99+
Remove-AzMySqlServer -Name mydemoreplicaserver -ResourceGroupName myresourcegroup
100+
```
101+
102+
### Delete a master server
103+
104+
> [!IMPORTANT]
105+
> Deleting a master server stops replication to all replica servers and deletes the master server
106+
> itself. Replica servers become standalone servers that now support both read and writes.
107+
108+
To delete a master server, you can run the `Remove-AzMySqlServer` cmdlet.
109+
110+
```azurepowershell-interactive
111+
Remove-AzMySqlServer -Name mydemoserver -ResourceGroupName myresourcegroup
112+
```
113+
114+
## Next steps
115+
116+
> [!div class="nextstepaction"]
117+
> [Restart Azure Database for MySQL server using PowerShell](howto-restart-server-powershell.md)

articles/mysql/howto-restart-server-powershell.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,8 @@ Restart the server with the following command:
4646
```azurepowershell-interactive
4747
Restart-AzMySqlServer -Name mydemoserver -ResourceGroupName myresourcegroup
4848
```
49+
50+
## Next steps
51+
52+
> [!div class="nextstepaction"]
53+
> [Create an Azure Database for MySQL server using PowerShell](quickstart-create-mysql-server-database-using-azure-powershell.md)

articles/mysql/howto-restore-server-powershell.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ms.devlang: azurepowershel
88
ms.topic: conceptual
99
ms.date: 4/28/2020
1010
---
11-
# How to back up and restore a server in Azure Database for MySQL using PowerShell
11+
# How to back up and restore an Azure Database for MySQL server using PowerShell
1212

1313
Azure Database for MySQL servers is backed up periodically to enable restore features. Using this
1414
feature you may restore the server and all its databases to an earlier point-in-time, on a new
@@ -162,6 +162,5 @@ original server are restored.
162162

163163
## Next steps
164164

165-
- Learn more about the service's [backups](concepts-backup.md)
166-
- Learn about [replicas](concepts-read-replicas.md)
167-
- Learn more about [business continuity](concepts-business-continuity.md) options
165+
> [!div class="nextstepaction"]
166+
> [Customize Azure Database for MySQL server parameters using PowerShell](howto-configure-server-parameters-using-powershell.md)

articles/mysql/quickstart-create-mysql-server-database-using-azure-powershell.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ Get-AzMySqlServer -Name mydemoserver -ResourceGroupName myresourcegroup |
164164
```Output
165165
FullyQualifiedDomainName AdministratorLogin
166166
------------------------ ------------------
167-
mrdemoserver.mysql.database.azure.com myadmin
167+
mydemoserver.mysql.database.azure.com myadmin
168168
```
169169

170170
## Connect to the server using the mysql command-line tool
@@ -273,3 +273,8 @@ To delete only the server created in this quickstart without deleting the resour
273273
```azurepowershell-interactive
274274
Remove-AzMySqlServer -Name mydemoserver -ResourceGroupName myresourcegroup
275275
```
276+
277+
## Next steps
278+
279+
> [!div class="nextstepaction"]
280+
> [Design an Azure Database for MySQL using PowerShell](tutorial-design-database-using-powershell.md)

0 commit comments

Comments
 (0)