Skip to content

Commit a6106be

Browse files
authored
Merge pull request #220927 from GennadNY/gennadyk897
Gennadyk897
2 parents 6ee2624 + 664b688 commit a6106be

File tree

1 file changed

+56
-9
lines changed

1 file changed

+56
-9
lines changed

articles/postgresql/flexible-server/concepts-data-encryption.md

Lines changed: 56 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -160,13 +160,15 @@ Some of the reasons why server state can become *Inaccessible* are:
160160

161161
## Setup Customer Managed Key during Server Creation
162162

163+
### From portal
164+
163165
Prerequisites:
164166

165167
- 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.
166168

167169
- 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
168170

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.
170172

171173
1. Navigate to Azure Database for PostgreSQL - Flexible Server create pane via Azure portal
172174

@@ -178,15 +180,51 @@ Follow the steps below to enable CMK while creating Postgres Flexible Server.
178180

179181
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
180182

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
213+
```azurecli-interactive
214+
az postgres flexible-server create -g <resource_group> -n <postgres_server_name> --location <azure_region> \
215+
--key '<key identifier of key created above>' --identity <identity_name>
216+
```
181217
## Update Customer Managed Key on the CMK enabled Flexible Server
182218

219+
### From portal
220+
183221
Prerequisites:
184222

185223
- 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.
186224

187225
- 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.
188226

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:
190228

191229
1. Navigate to Azure Database for PostgreSQL - Flexible Server create a page via the Azure portal.
192230

@@ -196,25 +234,34 @@ Follow the steps below to update CMK on CMK enabled Flexible Server:
196234

197235
1. Select different key by choosing subscription, Key Vault and key from dropdowns provided.
198236

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+
```
199250
## Limitations
200251

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:
202253

203254
- CMK encryption can only be configured during creation of a new server, not as an update to the existing Flexible Server.
204255

205256
- 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.
206257

207258
- CMK encryption isn't available on Burstable SKU.
208259

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-
213260
- **No support for revoking key after restoring CMK enabled server to another server**
214261

215-
- No support for Azure HSM Key Vault
262+
- No support for Geo backup enabled servers
216263

217-
- No CLI or PowerShell support
264+
- No support for Azure HSM Key Vault
218265

219266
## Next steps
220267

0 commit comments

Comments
 (0)