Skip to content

Commit 71984ba

Browse files
authored
Merge pull request #227014 from MicrosoftDocs/release-arc-data
February 2023 Publish for Arc data--scheduled release at 10AM of 2/14
2 parents e7d4015 + 38331d4 commit 71984ba

12 files changed

+559
-94
lines changed

articles/azure-arc/data/backup-restore-postgresql.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,35 @@ ms.topic: how-to
1313

1414
# Back up and restore Azure Arc-enabled PostgreSQL servers
1515

16-
Automated backups can be enabled by including the `--storage-class-backups` argument when creating an Azure Arc-enabled PostgreSQL server. Restore is not supported in the current preview release.
16+
Automated backups can be enabled by including the `--storage-class-backups` argument when creating an Azure Arc-enabled PostgreSQL server. Specify the retention period for backups with the `--retention-days` parameter, when creating or updating an Arc-enabled PostgreSQL server. The retention period can be between 0 and 35 days. If backups are enabled but no retention period is specified, the default is seven days.
17+
18+
Restoring an Azure Arc-enable PostgreSQL server creates a new server by copying the configuration of the existing server (for example resource requests/limits, extensions etc.). Configurations that could cause conflicts (for example primary endpoint port) aren't copied. The storage configuration for the new resource can be defined by passing `--storage-class*` and `--volume-size-*` parameters to the `restore` command.
19+
20+
Restore an Azure Arc-enabled PostgreSQL server to a new server with the `restore` command:
21+
```azurecli
22+
az postgres server-arc restore -n <destination-server-name> --source-server <source-server-name> --k8s-namespace <namespace> --use-k8s
23+
```
24+
25+
## Examples:
26+
27+
Create a new Arc-enabled PostgreSQL server `pg02` by restoring `pg01` using the latest backups:
28+
```azurecli
29+
az postgres server-arc restore -n pg02 --source-server pg01 --k8s-namespace arc --use-k8s
30+
```
31+
32+
Create a new Arc-enabled PostgreSQL server `pg02` by restoring `pg01` using the latest backups, defining new storage requirements for pg02:
33+
```azurecli
34+
az postgres server-arc restore -n pg02 --source-server pg01 --k8s-namespace arc --storage-class-data azurefile-csi-premium --volume-size-data 10Gi --storage-class-logs azurefile-csi-premium --volume-size-logs 2Gi--use-k8s --storage-class-backups azurefile-csi-premium --volume-size-backups 15Gi
35+
```
36+
37+
Create a new Arc-enabled PostgreSQL server `pg02` by restoring `pg01` to its state at `2023-02-01T00:00:00Z`:
38+
```azurecli
39+
az postgres server-arc restore -n pg02 --source-server pg01 --k8s-namespace arc -t 2023-02-01T00:00:00Z --use-k8s
40+
```
41+
42+
For details about all the parameters available for restore review the output of the command:
43+
```azurecli
44+
az postgres server-arc restore --help
45+
```
1746

1847
- Read about [scaling up or down (increasing/decreasing memory/vcores)](scale-up-down-postgresql-server-using-cli.md) your server.
Lines changed: 278 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,278 @@
1+
---
2+
title: Turn on transparent data encryption in Azure Arc-enabled SQL Managed Instance (preview)
3+
description: How-to guide to turn on transparent data encryption in an Azure Arc-enabled SQL Managed Instance (preview)
4+
author: GuptaSeattle
5+
ms.author: guptapra
6+
services: azure-arc
7+
ms.service: azure-arc
8+
ms.subservice: azure-arc-data-sqlmi
9+
ms.reviewer: mikeray
10+
ms.topic: how-to
11+
ms.date: 01/20/2023
12+
ms.custom: template-how-to, event-tier1-build-2022
13+
---
14+
15+
# Enable transparent data encryption on Azure Arc-enabled SQL Managed Instance (preview)
16+
17+
This article describes how to enable and disable transparent data encryption (TDE) at-rest on an Azure Arc-enabled SQL Managed Instance. In this article, the term *managed instance* refers to a deployment of Azure Arc-enabled SQL Managed Instance and enabling/disabling TDE will apply to all databases running on a managed instance.
18+
19+
Enabling service-managed transparent data encryption will require the managed instance to use a service-managed database master key as well as the service-managed server certificate. These credentials will be automatically created when service-managed transparent data encryption is enabled. For more info on TDE, please refer to [Transparent data encryption](/sql/relational-databases/security/encryption/transparent-data-encryption).
20+
21+
22+
Turning on the TDE feature does the following:
23+
24+
- All existing databases will now be automatically encrypted.
25+
- All newly created databases will get automatically encrypted.
26+
27+
[!INCLUDE [azure-arc-data-preview](../../../includes/azure-arc-data-preview.md)]
28+
29+
## Prerequisites
30+
31+
Before you proceed with this article, you must have an Azure Arc-enabled SQL Managed Instance resource created and connect to it.
32+
33+
- [An Azure Arc-enabled SQL Managed Instance created](./create-sql-managed-instance.md)
34+
- [Connect to Azure Arc-enabled SQL Managed Instance](./connect-managed-instance.md)
35+
36+
## Limitations
37+
38+
The following limitations must be considered when deploying Service-Managed TDE:
39+
40+
- Only General Purpose Tier is supported.
41+
- Failover Groups are not supported.
42+
43+
## Turn on transparent data encryption on the managed instance
44+
### Prerequisites
45+
46+
Turning on TDE on the managed instance will result in the following operations taking place:
47+
48+
1. Adding the service-managed database master key in the `master` database.
49+
2. Adding the service-managed certificate protector.
50+
3. Adding the associated Database Encryption Keys (DEK) on all databases on the managed instance.
51+
4. Enabling encryption on all databases on the managed instance.
52+
53+
### [Service-managed mode](#tab/service-managed-mode)
54+
55+
Run kubectl patch to enable service-managed TDE
56+
57+
```console
58+
kubectl patch sqlmi <sqlmi-name> --namespace <namespace> --type merge --patch '{ "spec": { "security": { "transparentDataEncryption": { "mode": "ServiceManaged" } } } }'
59+
```
60+
61+
Example:
62+
63+
```console
64+
kubectl patch sqlmi contososqlmi --namespace arc --type merge --patch '{ "spec": { "security": { "transparentDataEncryption": { "mode": "ServiceManaged" } } } }'
65+
```
66+
---
67+
68+
## Turn off transparent data encryption on the managed instance
69+
70+
Turning off TDE on the managed instance will result in the following operations taking place:
71+
72+
1. Disabling encryption on all databases on the managed instance.
73+
2. Dropping the associated DEKs on all databases on the managed instance.
74+
3. Dropping the service-managed certificate protector.
75+
4. Dropping the service-managed database master key in the `master` database.
76+
77+
### [Service-managed mode](#tab/service-managed-mode)
78+
79+
Run kubectl patch to disable service-managed TDE
80+
81+
```console
82+
kubectl patch sqlmi <sqlmi-name> --namespace <namespace> --type merge --patch '{ "spec": { "security": { "transparentDataEncryption": { "mode": null } } } }'
83+
```
84+
85+
Example:
86+
```console
87+
kubectl patch sqlmi contososqlmi --namespace arc --type merge --patch '{ "spec": { "security": { "transparentDataEncryption": { "mode": null } } } }'
88+
```
89+
---
90+
91+
## Back up a transparent data encryption credential
92+
93+
When you back up credentials from the managed instance, the credentials are stored within the container. To store credentials on a persistent volume, specify the mount path in the container. For example, `var/opt/mssql/data`. The following example backs up a certificate from the managed instance:
94+
95+
> [!NOTE]
96+
> If the `kubectl cp` command is run from Windows, the command may fail when using absolute Windows paths. Use relative paths or the commands specified below.
97+
98+
1. Back up the certificate from the container to `/var/opt/mssql/data`.
99+
100+
```sql
101+
USE master;
102+
GO
103+
104+
BACKUP CERTIFICATE <cert-name> TO FILE = '<cert-path>'
105+
WITH PRIVATE KEY ( FILE = '<private-key-path>',
106+
ENCRYPTION BY PASSWORD = '<UseStrongPasswordHere>');
107+
```
108+
109+
Example:
110+
111+
```sql
112+
USE master;
113+
GO
114+
115+
BACKUP CERTIFICATE MyServerCert TO FILE = '/var/opt/mssql/data/servercert.crt'
116+
WITH PRIVATE KEY ( FILE = '/var/opt/mssql/data/servercert.key',
117+
ENCRYPTION BY PASSWORD = '<UseStrongPasswordHere>');
118+
```
119+
120+
2. Copy the certificate from the container to your file system.
121+
122+
### [Windows](#tab/windows)
123+
124+
```console
125+
kubectl exec -n <namespace> -c arc-sqlmi <pod-name> -- cat <pod-certificate-path> > <local-certificate-path>
126+
```
127+
128+
Example:
129+
130+
```console
131+
kubectl exec -n arc-ns -c arc-sqlmi sql-0 -- cat /var/opt/mssql/data/servercert.crt > $HOME\sqlcerts\servercert.crt
132+
```
133+
134+
### [Linux](#tab/linux)
135+
```console
136+
kubectl cp --namespace <namespace> --container arc-sqlmi <pod-name>:<pod-certificate-path> <local-certificate-path>
137+
```
138+
139+
Example:
140+
141+
```console
142+
kubectl cp --namespace arc-ns --container arc-sqlmi sql-0:/var/opt/mssql/data/servercert.crt $HOME/sqlcerts/servercert.crt
143+
```
144+
---
145+
146+
3. Copy the private key from the container to your file system.
147+
148+
### [Windows](#tab/windows)
149+
```console
150+
kubectl exec -n <namespace> -c arc-sqlmi <pod-name> -- cat <pod-private-key-path> > <local-private-key-path>
151+
```
152+
153+
Example:
154+
155+
```console
156+
kubectl exec -n arc-ns -c arc-sqlmi sql-0 -- cat /var/opt/mssql/data/servercert.key > $HOME\sqlcerts\servercert.key
157+
```
158+
159+
### [Linux](#tab/linux)
160+
```console
161+
kubectl cp --namespace <namespace> --container arc-sqlmi <pod-name>:<pod-private-key-path> <local-private-key-path>
162+
```
163+
164+
Example:
165+
166+
```console
167+
kubectl cp --namespace arc-ns --container arc-sqlmi sql-0:/var/opt/mssql/data/servercert.key $HOME/sqlcerts/servercert.key
168+
```
169+
---
170+
171+
4. Delete the certificate and private key from the container.
172+
173+
```console
174+
kubectl exec -it --namespace <namespace> --container arc-sqlmi <pod-name> -- bash -c "rm <certificate-path> <private-key-path>
175+
```
176+
177+
Example:
178+
179+
```console
180+
kubectl exec -it --namespace arc-ns --container arc-sqlmi sql-0 -- bash -c "rm /var/opt/mssql/data/servercert.crt /var/opt/mssql/data/servercert.key"
181+
```
182+
183+
## Restore a transparent data encryption credential to a managed instance
184+
185+
Similar to above, to restore the credentials, copy them into the container and run the corresponding T-SQL afterwards.
186+
187+
188+
> [!NOTE]
189+
> If the `kubectl cp` command is run from Windows, the command may fail when using absolute Windows paths. Use relative paths or the commands specified below.
190+
> To restore database backups that have been taken before enabling TDE, you would need to disable TDE on the SQL Managed Instance, restore the database backup and enable TDE again.
191+
192+
1. Copy the certificate from your file system to the container.
193+
### [Windows](#tab/windows)
194+
```console
195+
type <local-certificate-path> | kubectl exec -i -n <namespace> -c arc-sqlmi <pod-name> -- tee <pod-certificate-path>
196+
```
197+
198+
Example:
199+
200+
```console
201+
type $HOME\sqlcerts\servercert.crt | kubectl exec -i -n arc-ns -c arc-sqlmi sql-0 -- tee /var/opt/mssql/data/servercert.crt
202+
```
203+
204+
### [Linux](#tab/linux)
205+
```console
206+
kubectl cp --namespace <namespace> --container arc-sqlmi <local-certificate-path> <pod-name>:<pod-certificate-path>
207+
```
208+
209+
Example:
210+
211+
```console
212+
kubectl cp --namespace arc-ns --container arc-sqlmi $HOME/sqlcerts/servercert.crt sql-0:/var/opt/mssql/data/servercert.crt
213+
```
214+
---
215+
216+
2. Copy the private key from your file system to the container.
217+
### [Windows](#tab/windows)
218+
```console
219+
type <local-private-key-path> | kubectl exec -i -n <namespace> -c arc-sqlmi <pod-name> -- tee <pod-private-key-path>
220+
```
221+
222+
Example:
223+
224+
```console
225+
type $HOME\sqlcerts\servercert.key | kubectl exec -i -n arc-ns -c arc-sqlmi sql-0 -- tee /var/opt/mssql/data/servercert.key
226+
```
227+
228+
### [Linux](#tab/linux)
229+
```console
230+
kubectl cp --namespace <namespace> --container arc-sqlmi <local-private-key-path> <pod-name>:<pod-private-key-path>
231+
```
232+
233+
Example:
234+
235+
```console
236+
kubectl cp --namespace arc-ns --container arc-sqlmi $HOME/sqlcerts/servercert.key sql-0:/var/opt/mssql/data/servercert.key
237+
```
238+
---
239+
240+
3. Create the certificate using file paths from `/var/opt/mssql/data`.
241+
242+
```sql
243+
USE master;
244+
GO
245+
246+
CREATE CERTIFICATE <certicate-name>
247+
FROM FILE = '<certificate-path>'
248+
WITH PRIVATE KEY ( FILE = '<private-key-path>',
249+
DECRYPTION BY PASSWORD = '<UseStrongPasswordHere>' );
250+
```
251+
252+
Example:
253+
254+
```sql
255+
USE master;
256+
GO
257+
258+
CREATE CERTIFICATE MyServerCertRestored
259+
FROM FILE = '/var/opt/mssql/data/servercert.crt'
260+
WITH PRIVATE KEY ( FILE = '/var/opt/mssql/data/servercert.key',
261+
DECRYPTION BY PASSWORD = '<UseStrongPasswordHere>' );
262+
```
263+
264+
4. Delete the certificate and private key from the container.
265+
266+
```console
267+
kubectl exec -it --namespace <namespace> --container arc-sqlmi <pod-name> -- bash -c "rm <certificate-path> <private-key-path>
268+
```
269+
270+
Example:
271+
272+
```console
273+
kubectl exec -it --namespace arc-ns --container arc-sqlmi sql-0 -- bash -c "rm /var/opt/mssql/data/servercert.crt /var/opt/mssql/data/servercert.key"
274+
```
275+
276+
## Next steps
277+
278+
[Transparent data encryption](/sql/relational-databases/security/encryption/transparent-data-encryption)

0 commit comments

Comments
 (0)