Skip to content

Commit e5a55d3

Browse files
committed
Added MySQL PowerShell docs and updated TOC
1 parent 889de40 commit e5a55d3

File tree

6 files changed

+572
-12
lines changed

6 files changed

+572
-12
lines changed

articles/mysql/TOC.yml

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,24 @@
99
- name: Quickstarts
1010
expanded: true
1111
items:
12-
- name: Create DB - Portal
13-
href: quickstart-create-mysql-server-database-using-azure-portal.md
14-
- name: Create DB - Azure CLI
15-
href: quickstart-create-mysql-server-database-using-azure-cli.md
16-
- name: Create DB - Azure CLI up command
17-
href: quickstart-create-server-up-azure-cli.md
12+
- name: Create DB
13+
items:
14+
- name: Create DB - Portal
15+
href: quickstart-create-mysql-server-database-using-azure-portal.md
16+
- name: Create DB - Azure CLI
17+
href: quickstart-create-mysql-server-database-using-azure-cli.md
18+
- name: Create DB - Azure CLI up command
19+
href: quickstart-create-server-up-azure-cli.md
20+
- name: Create DB - Azure PowerShell
21+
href: quickstart-create-mysql-server-database-using-azure-powershell.md
1822
- name: Connect & query
1923
items:
2024
- name: PHP
2125
href: connect-php.md
2226
- name: Java
2327
href: connect-java.md
2428
- name: .NET
25-
href: connect-csharp.md
29+
href: connect-csharp.md
2630
- name: Python
2731
href: connect-python.md
2832
- name: Node.js
@@ -74,7 +78,7 @@
7478
- name: Pricing tiers
7579
href: concepts-pricing-tiers.md
7680
- name: Prepay for reserved capacity
77-
href: concept-reserved-pricing.md
81+
href: concept-reserved-pricing.md
7882
- name: Limits
7983
href: concepts-limits.md
8084
- name: Data access & security
@@ -90,7 +94,7 @@
9094
- name: Virtual Network
9195
href: concepts-data-access-and-security-vnet.md
9296
- name: Advanced Threat Protection
93-
href: concepts-data-access-and-security-threat-protection.md
97+
href: concepts-data-access-and-security-threat-protection.md
9498
- name: Private Link
9599
href: concepts-data-access-security-private-link.md
96100
- name: Data Encryption
@@ -141,7 +145,7 @@
141145
- name: Data-in replication
142146
href: concepts-data-in-replication.md
143147
- name: Read replicas
144-
href: concepts-read-replicas.md
148+
href: concepts-read-replicas.md
145149
- name: How-to guides
146150
items:
147151
- name: Manage a server
@@ -160,6 +164,8 @@
160164
href: howto-restore-server-portal.md
161165
- name: Azure CLI
162166
href: howto-restore-server-cli.md
167+
- name: Azure PowerShell
168+
href: howto-restore-server-powershell.md
163169
- name: Migrate a database
164170
items:
165171
- name: Dump & restore
@@ -192,16 +198,18 @@
192198
href: howto-auto-grow-storage-portal.md
193199
- name: Azure CLI
194200
href: howto-auto-grow-storage-cli.md
201+
- name: Azure PowerShell
202+
href: howto-auto-grow-storage-powershell.md
195203
- name: Access server logs
196204
items:
197205
- name: Slow query logs
198-
items:
206+
items:
199207
- name: Azure portal
200208
href: howto-configure-server-logs-in-portal.md
201209
- name: Azure CLI
202210
href: howto-configure-server-logs-in-cli.md
203211
- name: Audit logs
204-
items:
212+
items:
205213
- name: Azure portal
206214
href: howto-configure-audit-logs-portal.md
207215
- name: Azure CLI
@@ -264,6 +272,8 @@
264272
href: howto-restart-server-portal.md
265273
- name: Azure CLI
266274
href: howto-restart-server-cli.md
275+
- name: Azure PowerShell
276+
href: howto-restart-server-powershell.md
267277
- name: Reference
268278
items:
269279
- name: Azure CLI
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
title: Auto grow storage - Azure PowerShell - Azure Database for MySQL
3+
description: This article describes how you can enable auto grow storage using PowerShell in Azure Database for MySQL.
4+
author: ajlam
5+
ms.author: andrela
6+
ms.service: mysql
7+
ms.topic: conceptual
8+
ms.date: 4/28/2020
9+
---
10+
# Auto grow storage in Azure Database for MySQL storage using PowerShell
11+
12+
This article describes how you can configure an Azure Database for MySQL server storage to grow
13+
without impacting the workload.
14+
15+
Storage auto grow prevents your server from
16+
[reaching the storage limit](/azure/mysql/concepts-pricing-tiers#reaching-the-storage-limit) and
17+
becoming read-only. For servers with 100 GB or less of provisioned storage, the size is increased by
18+
5 GB when the free space is below 10%. For servers with more than 100 GB of provisioned storage, the
19+
size is increased by 5% when the free space is below 10 GB. Maximum storage limits apply as
20+
specified in the storage section of the
21+
[Azure Database for MySQL pricing tiers](/azure/mysql/concepts-pricing-tiers#storage).
22+
23+
> [!IMPORTANT]
24+
> Remember that storage can only be scaled up, not down.
25+
26+
## Prerequisites
27+
28+
To complete this how-to guide, you need:
29+
30+
- The [Az PowerShell module](/powershell/azure/install-az-ps) installed locally or
31+
[Azure Cloud Shell](https://shell.azure.com/) in the browser
32+
- An [Azure Database for MySQL server](quickstart-create-mysql-server-database-using-azure-powershell.md)
33+
34+
> [!IMPORTANT]
35+
> While the Az.MySql PowerShell module is in preview, you must install it separately from the Az
36+
> PowerShell module using the following command: `Install-Module -Name Az.MySql -AllowPrerelease`.
37+
> Once the Az.MySql PowerShell module is generally available, it becomes part of future Az
38+
> PowerShell module releases and available natively from within Azure Cloud Shell.
39+
40+
If you choose to use PowerShell locally, connect to your Azure account using the
41+
[Connect-AzAccount](/powershell/module/az.accounts/Connect-AzAccount) cmdlet.
42+
43+
## Enable MySQL server storage auto grow
44+
45+
Enable server auto grow storage on an existing server with the following command:
46+
47+
```azurepowershell-interactive
48+
Update-AzMySqlServer -Name mydemoserver -ResourceGroupName myresourcegroup -StorageAutogrow Enabled
49+
```
50+
51+
Enable server auto grow storage while creating a new server with the following command:
52+
53+
```azurepowershell-interactive
54+
$Password = Read-Host -Prompt 'Please enter your password' -AsSecureString
55+
New-AzMySqlServer -Name mydemoserver -ResourceGroupName myresourcegroup -Sku GP_Gen5_2 -StorageAutogrow Enabled -Location westus -AdministratorUsername myadmin -AdministratorLoginPassword $Password
56+
```
57+
58+
## Next steps
59+
60+
Learn about [how to create alerts on metrics](howto-alert-on-metric.md).
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
title: Restart server - Azure PowerShell - Azure Database for MySQL
3+
description: This article describes how you can restart an Azure Database for MySQL server using PowerShell.
4+
author: ajlam
5+
ms.author: andrela
6+
ms.service: mysql
7+
ms.topic: conceptual
8+
ms.date: 4/28/2020
9+
---
10+
11+
# Restart Azure Database for MySQL server using PowerShell
12+
13+
This topic describes how you can restart an Azure Database for MySQL server. You may need to restart
14+
your server for maintenance reasons, which causes a short outage during the operation.
15+
16+
The server restart is blocked if the service is busy. For example, the service may be processing a
17+
previously requested operation such as scaling vCores.
18+
19+
The amount of time required to complete a restart depends on the MySQL recovery process. To reduce
20+
the restart time, we recommend you minimize the amount of activity occurring on the server before
21+
the restart.
22+
23+
## Prerequisites
24+
25+
To complete this how-to guide, you need:
26+
27+
- The [Az PowerShell module](/powershell/azure/install-az-ps) installed locally or
28+
[Azure Cloud Shell](https://shell.azure.com/) in the browser
29+
- An [Azure Database for MySQL server](quickstart-create-mysql-server-database-using-azure-powershell.md)
30+
31+
> [!IMPORTANT]
32+
> While the Az.MySql PowerShell module is in preview, you must install it separately from the Az
33+
> PowerShell module using the following command: `Install-Module -Name Az.MySql -AllowPrerelease`.
34+
> Once the Az.MySql PowerShell module is generally available, it becomes part of future Az
35+
> PowerShell module releases and available natively from within Azure Cloud Shell.
36+
37+
If you choose to use PowerShell locally, connect to your Azure account using the
38+
[Connect-AzAccount](/powershell/module/az.accounts/Connect-AzAccount) cmdlet.
39+
40+
[!INCLUDE [cloud-shell-try-it.md](../../includes/cloud-shell-try-it.md)]
41+
42+
## Restart the server
43+
44+
Restart the server with the following command:
45+
46+
```azurepowershell-interactive
47+
Restart-AzMySqlServer -Name mydemoserver -ResourceGroupName myresourcegroup
48+
```
Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
---
2+
title: Backup and restore - Azure PowerShell - Azure Database for MySQL
3+
description: Learn how to backup and restore a server in Azure Database for MySQL by using Azure PowerShell.
4+
author: ajlam
5+
ms.author: andrela
6+
ms.service: mysql
7+
ms.devlang: azurepowershel
8+
ms.topic: conceptual
9+
ms.date: 4/28/2020
10+
---
11+
# How to back up and restore a server in Azure Database for MySQL using PowerShell
12+
13+
Azure Database for MySQL servers is backed up periodically to enable restore features. Using this
14+
feature you may restore the server and all its databases to an earlier point-in-time, on a new
15+
server.
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+
## Set backup configuration
37+
38+
At server creation, you make the choice between configuring your server for either locally redundant
39+
or geographically redundant backups.
40+
41+
> [!NOTE]
42+
> After a server is created, the kind of redundancy it has, geographically redundant vs locally
43+
> redundant, can't be changed.
44+
45+
While creating a server via the `New-AzMySqlServer` command, the **GeoRedundantBackup**
46+
parameter decides your backup redundancy option. If **Enabled**, geo redundant backups are taken. Or
47+
if **Disabled**, locally redundant backups are taken.
48+
49+
The backup retention period is set by the **BackupRetentionDay** parameter.
50+
51+
For more information about setting these values during server creation, see
52+
[Create an Azure Database for MySQL server using PowerShell](quickstart-create-mysql-server-database-using-azure-powershell.md).
53+
54+
The backup retention period of a server can be changed as follows:
55+
56+
```azurepowershell-interactive
57+
Update-AzMySqlServer -Name mydemoserver -ResourceGroupName myresourcegroup -BackupRetentionDay 10
58+
```
59+
60+
The preceding example changes the backup retention period of mydemoserver to 10 days.
61+
62+
The backup retention period governs how far back a point-in-time restore can be retrieved, since
63+
it's based on available backups. Point-in-time restore is described further in the next section.
64+
65+
## Server point-in-time restore
66+
67+
You can restore the server to a previous point-in-time. The restored data is copied to a new server,
68+
and the existing server is left unchanged. For example, if a table is accidentally dropped, you can
69+
restore to the time just the drop occurred. Then, you can retrieve the missing table and data from
70+
the restored copy of the server.
71+
72+
To restore the server, use the `Restore-AzMySqlServer` PowerShell cmdlet.
73+
74+
### Run the restore command
75+
76+
To restore the server, run the following example from PowerShell.
77+
78+
```azurepowershell-interactive
79+
$restorePointInTime = (Get-Date).AddMinutes(-10)
80+
Get-AzMySqlServer -Name mydemoserver -ResourceGroupName myresourcegroup |
81+
Restore-AzMySqlServer -Name mydemoserver-restored -ResourceGroupName myresourcegroup -RestorePointInTime $restorePointInTime -UsePointInTimeRestore
82+
```
83+
84+
The **PointInTimeRestore** parameter set of the `Restore-AzMySqlServer` cmdlet requires the
85+
following parameters:
86+
87+
| Setting | Suggested value | Description  |
88+
| --- | --- | --- |
89+
| ResourceGroupName |  myresourcegroup |  The resource group where the source server exists.  |
90+
| Name | mydemoserver-restored | The name of the new server that is created by the restore command. |
91+
| RestorePointInTime | 2020-03-13T13:59:00Z | Select a point in time to restore. This date and time must be within the source server's backup retention period. Use the ISO8601 date and time format. For example, you can use your own local time zone, such as **2020-03-13T05:59:00-08:00**. You can also use the UTC Zulu format, for example, **2018-03-13T13:59:00Z**. |
92+
| UsePointInTimeRestore | `<SwitchParameter>` | Use point-in-time mode to restore. |
93+
94+
When you restore a server to an earlier point-in-time, a new server is created. The original server
95+
and its databases from the specified point-in-time are copied to the new server.
96+
97+
The location and pricing tier values for the restored server remain the same as the original server.
98+
99+
After the restore process finishes, locate the new server and verify that the data is restored as
100+
expected. The new server has the same server admin login name and password that was valid for the
101+
existing server at the time the restore was started. The password can be changed from the new
102+
server's **Overview** page.
103+
104+
The new server created during a restore does not have the VNet service endpoints that existed on the
105+
original server. These rules must be set up separately for the new server. Firewall rules from the
106+
original server are restored.
107+
108+
## Geo restore
109+
110+
If you configured your server for geographically redundant backups, a new server can be created from
111+
the backup of the existing server. This new server can be created in any region that Azure Database
112+
for MySQL is available.
113+
114+
To create a server using a geo redundant backup, use the `Restore-AzMySqlServer` command with the
115+
**UseGeoRestore** parameter.
116+
117+
> [!NOTE]
118+
> When a server is first created it may not be immediately available for geo restore. It may take a
119+
> few hours for the necessary metadata to be populated.
120+
121+
To geo restore the server, run the following example from PowerShell:
122+
123+
```azurepowershell-interactive
124+
Get-AzMySqlServer -Name mydemoserver -ResourceGroupName myresourcegroup |
125+
Restore-AzMySqlServer -Name mydemoserver-georestored -ResourceGroupName myresourcegroup -Location eastus -Sku GP_Gen5_8 -UseGeoRestore
126+
```
127+
128+
This example creates a new server called **mydemoserver-georestored** in the East US region that
129+
belongs to **myresourcegroup**. It is a General Purpose, Gen 5 server with 8 vCores. The server is
130+
created from the geo-redundant backup of **mydemoserver**, also in the resource group
131+
**myresourcegroup**.
132+
133+
To create the new server in a different resource group from the existing server, specify the new
134+
resource group name using the **ResourceGroupName** parameter as shown in the following example:
135+
136+
```azurepowershell-interactive
137+
Get-AzMySqlServer -Name mydemoserver -ResourceGroupName myresourcegroup |
138+
Restore-AzMySqlServer -Name mydemoserver-georestored -ResourceGroupName newresourcegroup -Location eastus -Sku GP_Gen5_8 -UseGeoRestore
139+
```
140+
141+
The **GeoRestore** parameter set of the `Restore-AzMySqlServer` cmdlet requires the following
142+
parameters:
143+
144+
| Setting | Suggested value | Description  |
145+
| --- | --- | --- |
146+
|ResourceGroupName | myresourcegroup | The name of the resource group the new server belongs to.|
147+
|Name | mydemoserver-georestored | The name of the new server. |
148+
|Location | eastus | The location of the new server. |
149+
|UseGeoRestore | `<SwitchParameter>` | Use geo mode to restore. |
150+
151+
When creating a new server using geo restore, it inherits the same storage size and pricing tier as
152+
the source server unless the **Sku** parameter is specified.
153+
154+
After the restore process finishes, locate the new server and verify that the data is restored as
155+
expected. The new server has the same server admin login name and password that was valid for the
156+
existing server at the time the restore was started. The password can be changed from the new
157+
server's **Overview** page.
158+
159+
The new server created during a restore does not have the VNet service endpoints that existed on the
160+
original server. These rules must be set up separately for this new server. Firewall rules from the
161+
original server are restored.
162+
163+
## Next steps
164+
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
33 KB
Loading

0 commit comments

Comments
 (0)