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/cognitive-search-custom-skill-interface.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,20 +8,20 @@ ms.service: cognitive-search
8
8
ms.custom:
9
9
- ignite-2023
10
10
ms.topic: how-to
11
-
ms.date: 06/29/2023
11
+
ms.date: 04/25/2024
12
12
---
13
13
14
14
# Add a custom skill to an Azure AI Search enrichment pipeline
15
15
16
-
An [AI enrichment pipeline](cognitive-search-concept-intro.md) can include both [built-in skills](cognitive-search-predefined-skills.md) and [custom skills](cognitive-search-custom-skill-web-api.md) that you personally create and publish. Your custom code executes externally to the search service (for example, as an Azure function), but accepts inputs and sends outputs to the skillset just like any other skill.
16
+
An [AI enrichment pipeline](cognitive-search-concept-intro.md) can include both [built-in skills](cognitive-search-predefined-skills.md) and [custom skills](cognitive-search-custom-skill-web-api.md) that you personally create and publish. Your custom code executes externally from the search service (for example, as an Azure function), but accepts inputs and sends outputs to the skillset just like any other skill.
17
17
18
18
Custom skills might sound complex but can be simple and straightforward in terms of implementation. If you have existing packages that provide pattern matching or classification models, the content you extract from blobs could be passed to these models for processing. Since AI enrichment is Azure-based, your model should be on Azure also. Some common hosting methodologies include using [Azure Functions](cognitive-search-create-custom-skill-example.md) or [Containers](https://github.com/Microsoft/SkillsExtractorCognitiveSearch).
19
19
20
20
If you're building a custom skill, this article describes the interface you use to integrate the skill into the pipeline. The primary requirement is the ability to accept inputs and emit outputs in ways that are consumable within the [skillset](cognitive-search-defining-skillset.md) as a whole. As such, the focus of this article is on the input and output formats that the enrichment pipeline requires.
21
21
22
22
## Benefits of custom skills
23
23
24
-
Building a custom skill gives you a way to insert transformations unique to your content. A custom skill executes independently, applying whatever enrichment step you require. For example, you could build custom classification models to differentiate business and financial contracts and documents, or add a speech recognition skill to reach deeper into audio files for relevant content. For a step-by-step example, see [Example: Creating a custom skill for AI enrichment](cognitive-search-create-custom-skill-example.md).
24
+
Building a custom skill gives you a way to insert transformations unique to your content. For example, you could build custom classification models to differentiate business and financial contracts and documents, or add a speech recognition skill to reach deeper into audio files for relevant content. For a step-by-step example, see [Example: Creating a custom skill for AI enrichment](cognitive-search-create-custom-skill-example.md).
25
25
26
26
## Set the endpoint and timeout interval
27
27
@@ -43,15 +43,15 @@ If instead your function or app uses Azure managed identities and Azure roles fo
43
43
44
44
+ Your function or app must be [configured for Microsoft Entra ID](../app-service/configure-authentication-provider-aad.md).
45
45
46
-
+ Your [custom skill definition](cognitive-search-custom-skill-web-api.md) must include an "authResourceId" property. This property takes an application (client) ID, in a [supported format](../active-directory/develop/security-best-practices-for-app-registration.md#application-id-uri): `api://<appId>`.
46
+
+ Your [custom skill definition](cognitive-search-custom-skill-web-api.md) must include an `authResourceId` property. This property takes an application (client) ID, in a [supported format](../active-directory/develop/security-best-practices-for-app-registration.md#application-id-uri): `api://<appId>`.
47
47
48
-
By default, the connection to the endpoint times out if a response isn't returned within a 30-second window. The indexing pipeline is synchronous and indexing will produce a timeout error if a response isn't received in that time frame. You can increase the interval to a maximum value of 230 seconds by setting the timeout parameter:
48
+
By default, the connection to the endpoint times out if a response isn't returned within a 30-second window (`PT30S`). The indexing pipeline is synchronous and indexing will produce a timeout error if a response isn't received in that time frame. You can increase the interval to a maximum value of 230 seconds by setting the timeout parameter (`PT230S`).
49
49
50
50
## Format Web API inputs
51
51
52
-
The Web API must accept an array of records to be processed. Each record must contain a property bag that is the input provided to your Web API.
52
+
The Web API must accept an array of records to be processed. Within each record, provide a property bag as input to your Web API.
53
53
54
-
Suppose you want to create a basic enricher that identifies the first date mentioned in the text of a contract. In this example, the custom skill accepts a single input "contractText" as the contract text. The skill also has a single output, which is the date of the contract. To make the enricher more interesting, return this "contractDate" in the shape of a multi-part complex type.
54
+
Suppose you want to create a basic enricher that identifies the first date mentioned in the text of a contract. In this example, the custom skill accepts a single input "contractText" as the contract text. The skill also has a single output, which is the date of the contract. To make the enricher more interesting, return this "contractDate" in the shape of a multipart complex type.
55
55
56
56
Your Web API should be ready to receive a batch of input records. Each member of the "values" array represents the input for a particular record. Each record is required to have the following elements:
57
57
@@ -69,7 +69,7 @@ The resulting Web API request might look like this:
69
69
"data":
70
70
{
71
71
"contractText":
72
-
"This is a contract that was issues on November 3, 2017 and that involves... "
72
+
"This is a contract that was issues on November 3, 2023 and that involves... "
73
73
}
74
74
},
75
75
{
@@ -91,7 +91,7 @@ The resulting Web API request might look like this:
91
91
}
92
92
```
93
93
94
-
In practice, your code may get called with hundreds or thousands of records instead of only the three shown here.
94
+
In practice, your code can be called with hundreds or thousands of records instead of only the three shown here.
95
95
96
96
## Format Web API outputs
97
97
@@ -111,7 +111,7 @@ The format of the output is a set of records containing a "recordId", and a prop
Copy file name to clipboardExpand all lines: articles/search/search-howto-aad.md
+13-15Lines changed: 13 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ author: gmndrg
6
6
ms.author: gimondra
7
7
ms.service: cognitive-search
8
8
ms.topic: how-to
9
-
ms.date: 05/09/2023
9
+
ms.date: 04/25/2024
10
10
ms.custom:
11
11
- subject-rbac-steps
12
12
- ignite-2023
@@ -18,9 +18,9 @@ Search applications that are built on Azure AI Search can now use the [Microsoft
18
18
19
19
This article shows you how to configure your client for Microsoft Entra ID:
20
20
21
-
+ For authentication, you'll create a [managed identity](../active-directory/managed-identities-azure-resources/overview.md)as the security principle. You could also use a different type of service principal object, but this article uses managed identities because they eliminate the need to manage credentials.
21
+
+ For authentication, create a [managed identity](../active-directory/managed-identities-azure-resources/overview.md)for your application. You can use a different type of security principal object, but this article uses managed identities because they eliminate the need to manage credentials.
22
22
23
-
+ For authorization, you'll assign an Azure role to the managed identity that grants permissions to run queries or manage indexing jobs.
23
+
+ For authorization, assign an Azure role to the managed identity that grants permissions to run queries or manage indexing jobs.
24
24
25
25
+ Update your client code to call [`TokenCredential()`](/dotnet/api/azure.core.tokencredential). For example, you can get started with new SearchClient(endpoint, new `DefaultAzureCredential()`) to authenticate via a Microsoft Entra ID using [Azure.Identity](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/identity/Azure.Identity/README.md).
26
26
@@ -48,15 +48,15 @@ In this step, configure your search service to recognize an **authorization** he
48
48
49
49
The change is effective immediately, but wait a few seconds before testing.
50
50
51
-
All network calls for search service operations and content will respect the option you select: API keys, bearer token, or either one if you select **Both**.
51
+
All network calls for search service operations and content respect the option you select: API keys, bearer token, or either one if you select **Both**.
52
52
53
-
When you enable role-based access control in the portal, the failure mode will be "http401WithBearerChallenge" if authorization fails.
53
+
When you enable role-based access control in the portal, the failure mode is "http401WithBearerChallenge" if authorization fails.
54
54
55
55
### [**REST API**](#tab/config-svc-rest)
56
56
57
57
Use the Management REST API [Create or Update Service](/rest/api/searchmanagement/services/create-or-update) to configure your service.
58
58
59
-
All calls to the Management REST API are authenticated through Microsoft Entra ID, with Contributor or Owner permissions. For help setting up authenticated requests in a REST client, see [Manage Azure AI Search using REST](search-manage-rest.md).
59
+
All calls to the Management REST API are authenticated through Microsoft Entra ID, with Contributor or Owner permissions. For help with setting up authenticated requests in a REST client, see [Manage Azure AI Search using REST](search-manage-rest.md).
60
60
61
61
1. Get service settings so that you can review the current configuration.
62
62
@@ -94,17 +94,17 @@ In this step, create a [managed identity](../active-directory/managed-identities
94
94
95
95
1. Search for **Managed Identities**.
96
96
97
-
1. Select **+ Create**.
97
+
1. Select **Create**.
98
98
99
99
1. Give your managed identity a name and select a region. Then, select **Create**.
100
100
101
101
:::image type="content" source="media/search-howto-aad/create-managed-identity.png" alt-text="Screenshot of the Create Managed Identity wizard." border="true" :::
102
102
103
103
## Assign a role to the managed identity
104
104
105
-
Next, you need to grant your managed identity access to your search service. Azure AI Search has various [built-in roles](search-security-rbac.md#built-in-roles-used-in-search). You can also create a [custom role](search-security-rbac.md#create-a-custom-role).
105
+
Next, you need to grant your client's managed identity access to your search service. Azure AI Search has various [built-in roles](search-security-rbac.md#built-in-roles-used-in-search). You can also create a [custom role](search-security-rbac.md#create-a-custom-role).
106
106
107
-
It's a best practice to grant minimum permissions. If your application only needs to handle queries, you should assign the [Search Index Data Reader](../role-based-access-control/built-in-roles.md#search-index-data-reader) role. Alternatively, if it needs both read and write access on a search index, you should use the [Search Index Data Contributor](../role-based-access-control/built-in-roles.md#search-index-data-contributor) role.
107
+
It's a best practice to grant minimum permissions. If your application only needs to handle queries, you should assign the [Search Index Data Reader](../role-based-access-control/built-in-roles.md#search-index-data-reader) role. Alternatively, if the client needs both read and write access on a search index, you should use the [Search Index Data Contributor](../role-based-access-control/built-in-roles.md#search-index-data-contributor) role.
108
108
109
109
1. Sign in to the [Azure portal](https://portal.azure.com).
110
110
@@ -125,10 +125,8 @@ It's a best practice to grant minimum permissions. If your application only need
125
125
+ Search Index Data Contributor
126
126
+ Search Index Data Reader
127
127
128
-
For more information on the available roles, see [Built-in roles used in Search](search-security-rbac.md#built-in-roles-used-in-search).
129
-
130
-
> [!NOTE]
131
-
> The Owner, Contributor, Reader, and Search Service Contributor roles don't give you access to the data within a search index, so you can't query a search index or index data using those roles. For data access to a search index, you need either the Search Index Data Contributor or Search Index Data Reader role.
128
+
> [!NOTE]
129
+
> The Owner, Contributor, Reader, and Search Service Contributor are control plane roles and don't give you access to the data within a search index. For data access, choose either the Search Index Data Contributor or Search Index Data Reader role. For more information on the scope and purpose of each role, see [Built-in roles used in Search](search-security-rbac.md#built-in-roles-used-in-search).
132
130
133
131
1. On the **Members** tab, select the managed identity that you want to give access to your search service.
134
132
@@ -177,9 +175,9 @@ The following instructions reference an existing C# sample to demonstrate the co
177
175
178
176
### Local testing
179
177
180
-
User-assigned managed identities work only in Azure environments. If you run this code locally, `DefaultAzureCredential`will fall back to authenticating with your credentials. Make sure you've also given yourself the required access to the search service if you plan to run the code locally.
178
+
User-assigned managed identities work only in Azure environments. If you run this code locally, `DefaultAzureCredential`falls back to authenticating with your credentials. Make sure you give yourself the required access to the search service if you plan to run the code locally.
181
179
182
-
1. Verify your account has role assignments to run all of the operations in the quickstart sample. To both create and query an index, you'll need "Search Index Data Reader" and "Search Index Data Contributor".
180
+
1. Verify your account has role assignments to run all of the operations in the quickstart sample. To both create and query an index, use "Search Index Data Reader" and "Search Index Data Contributor".
183
181
184
182
1. Go to **Tools** > **Options** > **Azure Service Authentication** to choose your Azure sign-on account.
0 commit comments