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/search/search-security-manage-encryption-keys.md
+43-61Lines changed: 43 additions & 61 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ Azure AI Search automatically encrypts data at rest with [service-managed keys](
20
20
21
21
This article walks you through the steps of setting up customer-managed key (CMK) or "bring-your-own-key" (BYOK) encryption. Here are some points to keep in mind:
22
22
23
-
+ CMK encryption is enacted on individual objects. If you require CMK across your search service, [set an enforcement policy](#encryption-enforcement-policy).
23
+
+ CMK encryption is enacted on individual objects. If you require CMK across your search service, [set an enforcement policy](#set-up-a-policy-to-enforce-cmk-compliance).
24
24
25
25
+ CMK encryption depends on [Azure Key Vault](/azure/key-vault/general/overview). You can create your own encryption keys and store them in a key vault, or you can use Azure Key Vault APIs to generate encryption keys. Azure Key Vault must be in the same subscription as Azure AI Search, but it can be in a different tenant. Using the same tenant makes it easier to retrieve your managed key by connecting through a system or user-managed identity. This behavior requires both services to share the same tenant. For more information about creating a tenant, see [Set up a new tenant](/azure/active-directory/develop/quickstart-create-new-tenant).
26
26
@@ -65,7 +65,7 @@ Although double encryption is now available in all regions, support was rolled o
65
65
66
66
+[Azure Key Vault](/azure/key-vault/general/overview) in the same subscription as Azure AI Search. You can [create a key vault using the Azure portal](/azure/key-vault/general/quick-create-portal), [Azure CLI](/azure/key-vault/general/quick-create-cli), or [Azure PowerShell](/azure/key-vault/general/quick-create-powershell). The key vault must have **soft-delete** and **purge protection** enabled.
67
67
68
-
+ A search client that can create an encrypted object. Into this code, you reference a key vault key and application registration information. This code could be a working app, or prototype code such as the [C# code sample DotNetHowToEncryptionUsingCMK](https://github.com/Azure-Samples/search-dotnet-getting-started/tree/master/DotNetHowToEncryptionUsingCMK).
68
+
+ A search client that can create an encrypted object. Into this code, you reference a key vault key and application registration information. This code could be a working app, or prototype code such as the [Python example](#python-example-of-an-encryption-key-configuration) in this article.
69
69
70
70
To add CMK support, create an object using the [REST client](search-get-started-rest.md), [Azure PowerShell](search-get-started-powershell.md), or an Azure SDK (Python, .NET, Java, JavaScript).
71
71
@@ -81,63 +81,13 @@ If you're new to Azure Key Vault, review this quickstart to learn about basic ta
81
81
82
82
+ Use as many key vaults as you need. Managed keys can be in different key vaults. A search service can have multiple encrypted objects, each one encrypted with a different customer-managed encryption key, stored in different key vaults.
83
83
84
-
+[Enable logging](/azure/key-vault/general/logging) on Key Vault so that you can monitor key usage.
84
+
+[Enable purge protection](/azure/key-vault/general/soft-delete-overview#purge-protection) and [soft-delete](/azure/key-vault/general/soft-delete-overview). Due to the nature of encryption with customer-managed keys, no one can retrieve your data if your Azure Key Vault key is deleted. To prevent data loss caused by accidental Key Vault key deletions, soft-delete and purge protection must be enabled on the key vault. Soft-delete is enabled by default, so you'll only encounter issues if you purposely disable it. Purge protection isn't enabled by default, but it's required for customer-managed key encryption in Azure AI Search.
85
85
86
-
+Remember to follow strict procedures during routine rotation of key vault keys and application secrets and registration. Always update all [encrypted content](search-security-get-encryption-keys.md) to use new secrets and keys before deleting the old ones. If you miss this step, your content can't be decrypted.
86
+
+[Enable logging](/azure/key-vault/general/logging) on the key vault so that you can monitor key usage.
87
87
88
-
## 1 - Enable purge protection
88
+
+[Enable autorotation of keys](/azure/key-vault/keys/how-to-configure-key-rotation) or follow strict procedures during routine rotation of key vault keys and application secrets and registration. Always update all [encrypted content](search-security-get-encryption-keys.md) to use new secrets and keys before deleting the old ones. If you miss this step, your content can't be decrypted.
89
89
90
-
As a first step, make sure [soft-delete](/azure/key-vault/general/soft-delete-overview) and [purge protection](/azure/key-vault/general/soft-delete-overview#purge-protection) are enabled on the key vault. Due to the nature of encryption with customer-managed keys, no one can retrieve your data if your Azure Key Vault key is deleted.
91
-
92
-
To prevent data loss caused by accidental Key Vault key deletions, soft-delete and purge protection must be enabled on the key vault. Soft-delete is enabled by default, so you'll only encounter issues if you purposely disable it. Purge protection isn't enabled by default, but it's required for customer-managed key encryption in Azure AI Search.
93
-
94
-
You can set both properties using the portal, PowerShell, or Azure CLI commands.
95
-
96
-
### [**Azure portal**](#tab/portal-pp)
97
-
98
-
1. Sign in to the [Azure portal](https://portal.azure.com) and open your key vault overview page.
99
-
100
-
1. On the **Overview** page under **Essentials**, enable **Soft-delete** and **Purge protection**.
101
-
102
-
### [**Using PowerShell**](#tab/ps-pp)
103
-
104
-
1. Run `Connect-AzAccount` to set up your Azure credentials.
105
-
106
-
1. Run the following command to connect to your key vault, replacing `<vault_name>` with a valid name:
+ If you have an [installation of Azure CLI](/cli/azure/install-azure-cli), you can run the following command to enable the required properties.
133
-
134
-
```azurecli-interactive
135
-
az keyvault update -n <vault_name> -g <resource_group> --enable-soft-delete --enable-purge-protection
136
-
```
137
-
138
-
---
139
-
140
-
## 2 - Create a key in Key Vault
90
+
## Step 1: Create a key in Key Vault
141
91
142
92
Skip key generation if you already have a key in Azure Key Vault that you want to use, but collect the key identifier. You need this information when creating an encrypted object.
143
93
@@ -161,7 +111,7 @@ Azure AI Search encryption supports RSA keys of sizes 2048, 3072 and 4096. For m
161
111
162
112
:::image type="content" source="media/search-manage-encryption-keys/cmk-key-identifier.png" alt-text="Create a new key vault key" border="true":::
163
113
164
-
## 3 - Create a security principal
114
+
## Step 2: Create a security principal
165
115
166
116
You have several options for setting up Azure AI Search access to the encryption key at run time. The simplest approach is to retrieve the key using the managed identity of your search service. You can use either a system or user-managed identity. Doing so allows you to omit the steps for application registration and application secrets. Alternatively, you can create and register a Microsoft Entra application and have the search service provides the application ID on requests.
167
117
@@ -262,7 +212,7 @@ Enable the system assigned managed identity for your search service.
262
212
263
213
---
264
214
265
-
## 4 - Grant permissions
215
+
## Step 3: Grant permissions
266
216
267
217
Azure Key Vault supports authorization using role-based access controls. We recommend this approach over key vault access policies. For more information, see [Provide access to Key Vault keys, certificates, and secrets using Azure roles](/azure/key-vault/general/rbac-guide).
268
218
@@ -302,9 +252,9 @@ Access permissions could be revoked at any given time. Once revoked, any search
302
252
303
253
<a name="encrypt-content"></a>
304
254
305
-
## 5 - Encrypt content
255
+
## Step 4: Encrypt content
306
256
307
-
Encryption keys are added when you create an object. To add a customer-managed key on an index, synonym map, indexer, data source, or skillset, use the [Search REST API](/rest/api/searchservice/) or an Azure SDK to create an object that has encryption enabled. The portal doesn't allow encryption properties on object creation.
257
+
Encryption keys are added when you create an object. To add a customer-managed key on an index, synonym map, indexer, data source, or skillset, use the [Search REST API](/rest/api/searchservice/) or an Azure SDK to create an object that has encryption enabled. To add encryption using the Azure SDK, see the [Python example](#python-example-of-an-encryption-key-configuration) in this article.
308
258
309
259
1. Call the Create APIs to specify the **encryptionKey** property:
Since encrypted content is decrypted prior to data refresh or queries, you won't see visual evidence of encryption. To verify encryption is working, check the resource logs.
Output from the query should produce results similar to the following example.
491
+
492
+
```
493
+
Score: 0.6130029
494
+
Id: 4
495
+
Description: The hotel is located in the heart of the historic center of Sublime in an extremely vibrant and lively area within short walking distance to the sites and landmarks of the city and is surrounded by the extraordinary beauty of churches, buildings, shops and monuments. Sublime Cliff is part of a lovingly restored 1800 palace.
496
+
Score: 0.26286605
497
+
Id: 1
498
+
Description: The hotel is ideally located on the main commercial artery of the city in the heart of New York. A few minutes away is Time's Square and the historic centre of the city, as well as other places of interest that make New York one of America's most attractive and cosmopolitan cities.
499
+
```
500
+
501
+
Since encrypted content is decrypted prior to data refresh or queries, you won't see visual evidence of encryption. To verify encryption is working, check the resource logs.
0 commit comments