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/postgresql/flexible-server/concepts-data-encryption.md
+56-9Lines changed: 56 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -160,13 +160,15 @@ Some of the reasons why server state can become *Inaccessible* are:
160
160
161
161
## Setup Customer Managed Key during Server Creation
162
162
163
+
### From portal
164
+
163
165
Prerequisites:
164
166
165
167
- Azure Active Directory (Azure AD) user managed identity in region where Postgres Flex Server will be created. Follow this [tutorial](../../active-directory/managed-identities-azure-resources/qs-configure-portal-windows-vm.md) to create identity.
166
168
167
169
- Key Vault with key in region where Postgres Flex Server will be created. Follow this [tutorial](../../key-vault/general/quick-create-portal.md) to create Key Vault and generate key. Follow [requirements section above](#requirements-for-configuring-data-encryption-for-azure-database-for-postgresql-flexible-server) for required Azure Key Vault settings
168
170
169
-
Follow the steps below to enable CMK while creating Postgres Flexible Server.
171
+
Follow the steps below to enable CMK while creating Postgres Flexible Server using Azure portal.
170
172
171
173
1. Navigate to Azure Database for PostgreSQL - Flexible Server create pane via Azure portal
172
174
@@ -178,15 +180,51 @@ Follow the steps below to enable CMK while creating Postgres Flexible Server.
178
180
179
181
1. Once it's finished, you should be able to navigate to Data Encryption (preview) screen for the server and update identity or key if necessary
180
182
183
+
184
+
### From CLI:
185
+
186
+
Prerequisites:
187
+
188
+
- You must have an Azure subscription and be an administrator on that subscription.
189
+
190
+
Follow the steps below to enable CMK while creating Postgres Flexible Server using Azure CLI.
191
+
192
+
1. Create a key vault and a key to use for a customer-managed key. Also enable purge protection and soft delete on the key vault.
193
+
194
+
```azurecli-interactive
195
+
az keyvault create -g <resource_group> -n <vault_name> --location <azure_region> --enable-purge-
196
+
protection true
197
+
```
198
+
199
+
2. In the created Azure Key Vault, create the key that will be used for the data encryption of the Azure Database for PostgreSQL - Flexible server.
200
+
201
+
```azurecli-interactive
202
+
az keyvault key create --name <key_name> -p software --vault-name <vault_name>
203
+
```
204
+
3. Create Managed Identity which will be used to retrieve key from Azure Key Vault
205
+
```azurecli-interactive
206
+
az identity create -g <resource_group> --name <identity_name> --location <azure_region>
207
+
```
208
+
4. Add access policy with key permissions of *wrapKey*,*unwrapKey*, *get*, *list* in Azure KeyVault to the managed identity we created above
209
+
```azurecli-interactive
210
+
az keyvault set-policy -g <resource_group> -n <vault_name> --object-id '<principalID of managed_identity>' --key-permissions wrapKey unwrapKey get list
211
+
```
212
+
5. Finally, lets create Azure Database for PostgreSQL - Flexible Server with CMK based encryption enabled
--key '<key identifier of key created above>' --identity <identity_name>
216
+
```
181
217
## Update Customer Managed Key on the CMK enabled Flexible Server
182
218
219
+
### From portal
220
+
183
221
Prerequisites:
184
222
185
223
- Azure Active Directory (Azure AD) user-managed identity in region where Postgres Flex Server will be created. Follow this [tutorial](../../active-directory/managed-identities-azure-resources/qs-configure-portal-windows-vm.md) to create identity.
186
224
187
225
- Key Vault with key in region where Postgres Flex Server will be created. Follow this [tutorial](../../key-vault/general/quick-create-portal.md) to create Key Vault and generate key.
188
226
189
-
Follow the steps below to update CMK on CMK enabled Flexible Server:
227
+
Follow the steps below to update CMK on CMK enabled Flexible Server using Azure portal:
190
228
191
229
1. Navigate to Azure Database for PostgreSQL - Flexible Server create a page via the Azure portal.
192
230
@@ -196,25 +234,34 @@ Follow the steps below to update CMK on CMK enabled Flexible Server:
196
234
197
235
1. Select different key by choosing subscription, Key Vault and key from dropdowns provided.
198
236
237
+
238
+
### From CLI
239
+
240
+
Prerequisites:
241
+
- You must have an Azure subscription and be an administrator on that subscription.
242
+
- Key Vault with key in region where Postgres Flex Server will be created. Follow this [tutorial](../../key-vault/general/quick-create-portal.md) to create Key Vault and generate key.
243
+
244
+
Follow the steps below to change\rotate key or identity after creation of server with data encryption.
245
+
1. Change key/identity for data encryption for existing server
246
+
```azurecli-interactive
247
+
az postgres flexible-server update --resource-group <resource_group> --name <server_name> \
248
+
--key '<key identifier of new AKV key>' --identity <identity_name>
249
+
```
199
250
## Limitations
200
251
201
-
The following are limitations for configuring the customer-managed key in Flexible Server:
252
+
The following are current limitations for configuring the customer-managed key in Flexible Server:
202
253
203
254
- CMK encryption can only be configured during creation of a new server, not as an update to the existing Flexible Server.
204
255
205
256
- Once enabled, CMK encryption can't be removed. If customer desires to remove this feature, it can only be done via restore of the server to non-CMK server.
206
257
207
258
- CMK encryption isn't available on Burstable SKU.
208
259
209
-
The following are other limitations for the public preview of configuring the customer-managed key that we expect to remove at the General Availability of this feature:
210
-
211
-
- No support for Geo backup enabled servers
212
-
213
260
-**No support for revoking key after restoring CMK enabled server to another server**
0 commit comments