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
Data stored in your Azure Cosmos DB account is automatically and seamlessly encrypted. Azure Cosmos DB offers two options for managing the keys used to encrypt your data at rest:
18
-
-**Service-managed keys**. By default, Microsoft manages the keys used to encrypt your Azure Cosmos DB account.
19
-
-**Customer-managed keys (CMK)**. You can optionally choose to add a second layer of encryption with keys you manage.
17
+
Data stored in your Azure Cosmos account is automatically and seamlessly encrypted. Azure Cosmos DB offers two options to manage the keys used to encrypt the data at rest:
20
18
21
-
Customer-managed keys must be stored in [Azure Key Vault](../key-vault/key-vault-overview.md). A key must be provided for each CMK-enabled account and is used to encrypt all the data stored in that account.
19
+
-**Service-managed keys** - By default, Microsoft manages the keys that are used to encrypt the data in your Azure Cosmos account.
22
20
23
-
## Setup
21
+
-**Customer-managed keys (CMK)**- You can optionally choose to add a second layer of encryption with your own keys.
24
22
25
-
Currently, customer-managed keys are only available for new accounts and need to be set up during account creation.
23
+
You must store customer-managed keys in the [Azure Key Vault](../key-vault/key-vault-overview.md) and provide a key for each Azure Cosmos account that is enabled with customer-managed keys. This key is used to encrypt all the data stored in that account.
26
24
27
-
### 1. Make sure the Azure Cosmos DB resource provider is registered for your Azure subscription
25
+
> [!NOTE]
26
+
> Currently, customer-managed keys are only available for new Azure Cosmos accounts and you should configure them during account creation.
27
+
28
+
## <aid="register-resource-provider"></a> Register the Azure Cosmos DB resource provider for your Azure subscription
28
29
29
-
From the Azure portal, go to your Azure subscription and select **Resource providers**from the left menu:
30
+
1. Sign into the [Azure portal](https://portal.azure.com/), go to your Azure subscription and select **Resource providers**under the **Settings** tab:
30
31
31
-

32
+

32
33
33
-
Search for the **Microsoft.DocumentDB** resource provider.
34
-
- If the resource provider is already marked as registered, nothing needs to be done.
35
-
- If not, select it and click on **Register**:
34
+
1. Search for the **Microsoft.DocumentDB** resource provider. Verify if the resource provider is already marked as registered. If not, choose the resource provider and select **Register**:
36
35
37
-

36
+

38
37
39
-
### 2. Configure your Azure Key Vault instance
38
+
## Configure your Azure Key Vault instance
40
39
41
-
Using customer-managed keys with Azure Cosmos DB requires two properties to be set on the Azure Key Vault instance you plan to use to host your encryption keys: **Soft Delete** and **Do Not Purge**. These properties aren't enabled by default but can be enabled using either PowerShell or the Azure CLI.
40
+
Using customer-managed keys with Azure Cosmos DB requires you to set two properties on the Azure Key Vault instance that you plan to use to host your encryption keys. These properties include **Soft Delete** and **Do Not Purge**. These properties aren't enabled by default, you can enable them by using either PowerShell or the Azure CLI.
41
+
42
+
To learn how to enable these properties on an existing Azure Key Vault instance, see the "Enabling soft-delete" and "Enabling Purge Protection" sections in one of the following articles:
42
43
43
-
To learn how to enable these properties on an existing Azure Key Vault instance, see the sections titled Enabling soft-delete and Enabling Purge Protection in one of the following articles:
44
44
-[How to use soft-delete with PowerShell](../key-vault/key-vault-soft-delete-powershell.md)
45
45
-[How to use soft-delete with Azure CLI](../key-vault/key-vault-soft-delete-cli.md)
46
46
47
-
### 3. Add an access policy to your Azure Key Vault instance
47
+
## Add an access policy to your Azure Key Vault instance
48
+
49
+
1. From the Azure portal, go to the Azure Key Vault instance that you plan to use to host your encryption keys. Select **Access Policies** from the left menu:
48
50
49
-
From the Azure portal, go to the Azure Key Vault instance you plan to use to host your encryption keys. Then, select **Access Policies** from the left menu:
51
+

50
52
51
-

53
+
1. Select **+ Add Access Policy**
52
54
53
-
- Select **+ Add Access Policy**
54
-
- Under the **Key permissions** dropdown menu, select **Get**, **Unwrap Key** and **Wrap Key**:
55
+
1. Under the **Key permissions** dropdown menu, select **Get**, **Unwrap Key** and **Wrap Key** permissions:
55
56
56
-

57
+

57
58
58
-
- Under **Select principal**, select **None selected**. Then, search for and select the **Azure Cosmos DB** principal. Finally, click **Select** at the bottom (if the **Azure Cosmos DB** principal can't be found, you may need to re-register the **Microsoft.DocumentDB** resource provider at step 1):
59
+
1. Under **Select principal**, select **None selected**. Then, search for **Azure Cosmos DB** principal and select it. Finally, click **Select** at the bottom (if the **Azure Cosmos DB** principal isn't in the list, you may need to re-register the **Microsoft.DocumentDB** resource provider as described in [register the resource provider](#register-resource-provider) section of this article):
59
60
60
-

61
+

61
62
62
-
- Select **Add** to add the new access policy
63
+
1. Select **Add** to add the new access policy
63
64
64
-
### 4. Generate a key in Azure Key Vault
65
+
## Generate a key in Azure Key Vault
65
66
66
-
From the Azure portal, go the Azure Key Vault instance you plan to use to host your encryption keys. Then, select **Keys** from the left menu:
67
+
1.From the Azure portal, go the Azure Key Vault instance that you plan to use to host your encryption keys. Then, select **Keys** from the left menu:
67
68
68
-

69
+

69
70
70
-
- Select **Generate/Import**
71
-
- Provide a name for the new key, select an RSA key size (a minimum of 3072 is recommended for best security) and select **Create**:
71
+
1. Select **Generate/Import**, provide a name for the new key, select an RSA key size (a minimum of 3072 is recommended for best security), and then select **Create**:
72
72
73
-

73
+

74
74
75
-
- Once the key is created, click on the newly created key, then on its current version
76
-
- Copy the key’s **Key Identifier** except the part after the last forward slash:
75
+
1. After the key is created, select the newly created key, and then on its current version.
77
76
78
-

77
+
1. Copy the key’s **Key Identifier** except the part after the last forward slash:
79
78
80
-
### 5. Create a new Azure Cosmos DB account
79
+

81
80
82
-
#### Using the Azure portal
81
+
##Create a new Azure Cosmos account
83
82
84
-
When creating a new Azure Cosmos DB account from the Azure portal, choose **Customer-managed key** at the **Encryption** step. In the **Key URI** field, pass the URI of the Azure Key Vault key copied from step 4:
83
+
### Using the Azure portal
84
+
85
+
When creating a new Azure Cosmos DB account from the Azure portal, choose **Customer-managed key** in the **Encryption** step. In the **Key URI** field, paste the URI/key identifier of the Azure Key Vault key that you copied from the previous step:
85
86
86
87

87
88
88
-
####Using PowerShell
89
+
### Using Azure PowerShell
89
90
90
91
When creating a new Azure Cosmos DB account with PowerShell,
91
-
- pass the URI of the Azure Key Vault key copied from step 4 under the **keyVaultKeyUri** property in the **PropertyObject**,
92
-
- make sure to use "2019-12-12" as the API version.
92
+
93
+
- Pass the URI of the Azure Key Vault key copied from earlier under the **keyVaultKeyUri** property in the **PropertyObject**
94
+
95
+
- Use **2019-12-12** as the API version.
93
96
94
97
> [!IMPORTANT]
95
-
> The `Location` parameter has to be set explicitly for the account to be successfully created with CMK.
98
+
> You must set the `Location` parameter explicitly for the account to be successfully created with customer-managed keys.
### Is there any additional charge when using customer-managed keys?
183
190
184
-
Yes. To account for the additional compute load that is required to manage data encryption and decryption with customer-managed keys, all operations executed against the Azure Cosmos DB account get a 25% increase in [Request Units](./request-units.md) consumed.
191
+
Yes. To account for the additional compute load that is required to manage data encryption and decryption with customer-managed keys, all operations executed against the Azure Cosmos account consume a 25% increase in [Request Units](./request-units.md).
192
+
193
+
### What data gets encrypted with the customer-managed keys?
194
+
195
+
All the data stored in your Azure Cosmos account is encrypted with the customer-managed keys, except for the following meta-data:
196
+
197
+
- The names of your Azure Cosmos DB [accounts, databases, and containers](./account-overview.md#elements-in-an-azure-cosmos-account)
198
+
199
+
- The names of your [stored procedures](./stored-procedures-triggers-udfs.md)
185
200
186
-
### What data gets encrypted with the CMK?
201
+
- The property paths declared in your [indexing policies](./index-policy.md)
187
202
188
-
All the data stored in your Azure Cosmos DB account gets encrypted with the CMK, except for the following meta-data:
189
-
- the names of your Azure Cosmos DB [accounts, databases and containers](./account-overview.md#elements-in-an-azure-cosmos-account),
190
-
- the names of your [stored procedures](./stored-procedures-triggers-udfs.md),
191
-
- the property paths declared in your [indexing policies](./index-policy.md),
192
-
- the values of your containers' [partition key](./partitioning-overview.md).
203
+
- The values of your containers' [partition key](./partitioning-overview.md)
193
204
194
-
### Will customer-managed keys be supported for existing accounts?
205
+
### Are customer-managed keys supported for existing Azure Cosmos accounts?
195
206
196
207
This feature is currently available for new accounts only.
197
208
198
209
### Is there a plan to support finer granularity than account-level keys?
199
210
200
211
Not currently, however container-level keys are being considered.
201
212
202
-
### How does customer-managed keys affect backups?
213
+
### How does customer-managed keys affect a backup?
203
214
204
-
Azure Cosmos DB takes [regular and automatic backups](./online-backup-and-restore.md) of the data stored in your account. This operation backs up the encrypted data. For a restored backup to be usable, the encryption key used at the time of the backup must still be available. This means that no revocation shall have been made and the version of the key that was used at the time of the backup shall still be enabled.
215
+
Azure Cosmos DB takes [regular and automatic backups](./online-backup-and-restore.md) of the data stored in your account. This operation backs up the encrypted data. To use the restored backup, the encryption key that you used at the time of the backup is required. This means that no revocation shall have been made and the version of the key that was used at the time of the backup shall still be enabled.
205
216
206
217
### How do I revoke an encryption key?
207
218
208
219
Key revocation is done by disabling the latest version of the key:
209
220
210
-

221
+

211
222
212
223
Alternatively, to revoke all keys from an Azure Key Vault instance, you can delete the access policy granted to the Azure Cosmos DB principal:
0 commit comments