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-trimming-for-azure-search-with-aad.md
+5-4Lines changed: 5 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,15 +7,16 @@ manager: nitinme
7
7
author: HeidiSteen
8
8
ms.author: heidist
9
9
ms.service: cognitive-search
10
-
ms.topic: conceptual
11
-
ms.date: 01/30/2023
10
+
ms.topic: how-to
11
+
ms.date: 03/24/2023
12
12
ms.custom: devx-track-csharp
13
13
---
14
14
# Security filters for trimming Azure Cognitive Search results using Active Directory identities
15
15
16
16
This article demonstrates how to use Azure Active Directory (AD) security identities together with filters in Azure Cognitive Search to trim search results based on user group membership.
17
17
18
18
This article covers the following tasks:
19
+
19
20
> [!div class="checklist"]
20
21
> - Create Azure AD groups and users
21
22
> - Associate the user with the group you have created
@@ -30,7 +31,7 @@ This article covers the following tasks:
30
31
31
32
Your index in Azure Cognitive Search must have a [security field](search-security-trimming-for-azure-search.md) to store the list of group identities having read access to the document. This use case assumes a one-to-one correspondence between a securable item (such as an individual's college application) and a security field specifying who has access to that item (admissions personnel).
32
33
33
-
You must have Azure AD administrator permissions (Owner or administrator), required in this walkthrough for creating users, groups, and associations.
34
+
You must have Azure AD administrator permissions (Owner or administrator) to create users, groups, and associations.
34
35
35
36
Your application must also be registered with Azure AD as a multi-tenant app, as described in the following procedure.
36
37
@@ -46,7 +47,7 @@ This step integrates your application with Azure AD for the purpose of accepting
46
47
47
48
1. Once the app registration is created, copy the Application ID. You'll need to provide this string to your application.
48
49
49
-
If you're stepping through the [DotNetHowToSecurityTrimming](https://github.com/Azure-Samples/search-dotnet-getting-started/tree/master/DotNetHowToEncryptionUsingCMK), paste this value into the **app.config** file.
50
+
If you're stepping through the [DotNetHowToSecurityTrimming](https://github.com/Azure-Samples/search-dotnet-getting-started/tree/master/DotNetHowToSecurityTrimming), paste this value into the **app.config** file.
Copy file name to clipboardExpand all lines: articles/search/search-security-trimming-for-azure-search.md
+14-14Lines changed: 14 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,50 +7,50 @@ manager: nitinme
7
7
author: HeidiSteen
8
8
ms.author: heidist
9
9
ms.service: cognitive-search
10
-
ms.topic: conceptual
10
+
ms.topic: how-to
11
11
ms.date: 03/24/2023
12
12
---
13
13
14
14
# Security filters for trimming results in Azure Cognitive Search
15
15
16
-
Cognitive Search doesn't provide document-level permissions and can't vary search results based on user permissions. As a workaround, you can create a filter that trims search results based on a string consisting of user identity information.
16
+
Cognitive Search doesn't provide document-level permissions and can't vary search results from the within the same index by user permissions. As a workaround, you can create a filter that trims search results based on a string containing a group or user identity.
17
17
18
18
This article describes a pattern for security filtering that includes following steps:
19
19
20
20
> [!div class="checklist"]
21
-
> * Assemble source documents that contain the required content
22
-
> * Create a field in your search index to contain the principal identifiers
21
+
> * Assemble source documents with the required content
22
+
> * Create a field for the principal identifiers
23
23
> * Push the documents to the search index for indexing
24
-
> * Query the index with `search.in` filter function
24
+
> * Query the index with the `search.in` filter function
25
25
26
-
## Choosing the security filter pattern
26
+
## About the security filter pattern
27
27
28
-
Although Cognitive Search doesn't integrate with security subsystems at query time, many customers who have document-level security requirements have found that filters can meet their needs.
28
+
Although Cognitive Search doesn't integrate with security subsystems for access to content within an index, many customers who have document-level security requirements have found that filters can meet their needs.
29
29
30
-
In Cognitive Search, a security filter is a regular OData filter that includes or excludes a search result based on a matching value. The security principal is just a string. There's no authentication or authorization. The service uses the string as filter criteria to include or exclude a document from the search results.
30
+
In Cognitive Search, a security filter is a regular OData filter that includes or excludes a search result based on a matching value, except that in a security filter, the criteria is a string consisting of a security principal. There's no authentication or authorization through the security principal. The principal is just a string, used in a filter expression, to include or exclude a document from the search results.
31
31
32
32
There are several ways to achieve security filtering. One way is through a complicated disjunction of equality expressions: for example, `Id eq 'id1' or Id eq 'id2'`, and so forth. This approach is error-prone, difficult to maintain, and in cases where the list contains hundreds or thousands of values, slows down query response time by many seconds.
33
33
34
-
A better solution is using the `search.in` function for security filters. This solution is described in this article. If you use `search.in(Id, 'id1, id2, ...')` instead of an equality expression, you can expect subsecond response times.
34
+
A better solution is using the `search.in` function for security filters, as described in this article. If you use `search.in(Id, 'id1, id2, ...')` instead of an equality expression, you can expect subsecond response times.
35
35
36
36
## Prerequisites
37
37
38
-
*You must have a [search index](search-what-is-an-index.md) that you can modify.
38
+
*The field containing group or user identity must be a string with the "filterable" attribute. It should be a collection. It shouldn't allow nulls.
39
39
40
-
*You must also have source documents that include a field containing a group or user identity having access to the document. This information becomes the filter criteria against which documents are selected or rejected from the result set returned to the issuer. In the following JSON documents, the "security_id" fields contain an identity string that can be used in a security filter.
40
+
*Other fields in the same document should provide the content that's accessible to that group or user. In the following JSON documents, the "security_id" fields contain identities used in a security filter, and the name, salary, and marital status will be included if the identity of the caller matches the "security_id" of the document.
41
41
42
42
```json
43
43
{
44
44
"Employee-1": {
45
45
"id": "000-0000-00-0-00000-1",
46
-
"name": "Sanchez",
46
+
"name": "Abram",
47
47
"salary": 75000,
48
48
"married": true,
49
49
"security_id": "10011"
50
50
},
51
51
"Employee-2": {
52
52
"id": "000-0000-00-0-00000-2",
53
-
"name": "Smith",
53
+
"name": "Adams",
54
54
"salary": 75000,
55
55
"married": true,
56
56
"security_id": "20022"
@@ -59,7 +59,7 @@ A better solution is using the `search.in` function for security filters. This s
59
59
```
60
60
61
61
>[!NOTE]
62
-
> The process of retrieving the principal identifiers and injecting those strings into source documents that can be indexed by Cognitive Search isn't covered in this article. See the documentation of your identity service provider for help with obtaining identifiers.
62
+
> The process of retrieving the principal identifiers and injecting those strings into source documents that can be indexed by Cognitive Search isn't covered in this article. Refer to the documentation of your identity service provider for help with obtaining identifiers.
0 commit comments