我尝试从 Azure AI 搜索自定义 Web 技能访问受 Microsoft Entra ID 保护的 Azure 函数。 https://learn.microsoft.com/en-us/azure/app-service/configure-authentication-provider-aad?tabs=workforce-configuration
根据文档,我可以使用
authResourceId
访问该功能,但在Azure Portal上保存技能集后该功能消失了。当然,由于身份验证,对该功能的请求会失败。
https://learn.microsoft.com/en-us/azure/search/cognitive-search-custom-skill-web-api
在门户上保存后我的技能定义。保存时没有错误信息。
然后重新打开相同的技能组。
authResourceId
消失了。在调试会话中保存编辑的技能设置后也会发生这种情况。
如果我禁用 Entra ID 身份验证功能,AI 搜索索引器和 Azure 功能都可以很好地工作。
===编辑===
我尝试通过 VS Code 的 REST 客户端扩展通过 REST API 制作技能组,但
authResourceId
也没有持续存在。这是要求。为了简单起见,我省略了一些部分。
@endpoint=https://XXXX.search.windows.net
POST {{endpoint}}/skillsets?api-version=2023-10-01-Preview
Content-type: application/json
Authorization: Bearer {{token}}
{
"name": "test04-index-custom-skillset",
"skills": [
{
"@odata.type": "#Microsoft.Skills.Custom.WebApiSkill",
"name": "custom-embeding-skill",
"description": "Custom-Skill-AzureFunctions",
"context": "/document/pages/*",
"inputs": [
{
"name": "text",
"source": "/document/pages/*",
"inputs": []
}
],
"outputs": [
{
"name": "vector",
"targetName": "text_vector"
}
],
"authResourceId": "api://appKey",
"uri": "https://xxxx.azurewebsites.net/api/vectorize",
"httpHeaders": {},
"httpMethod": "POST",
"timeout": "PT30S",
"batchSize": 1000
}
],
"indexProjections": {
"selectors": [
{
"targetIndexName": "test02-custom-skill-index",
"parentKeyFieldName": "parent_id",
"sourceContext": "/document/pages/*",
"mappings": [
{
"name": "contentVector",
"source": "/document/pages/*/text_vector"
}
}
],
"parameters": {
"projectionMode": "skipIndexingParentDocuments"
}
}
}
答案是。
HTTP/1.1 201 Created
Transfer-Encoding: chunked
Content-Type: application/json; odata.metadata=minimal; odata.streaming=true; charset=utf-8
ETag: "0x8DD02DF818256FB"
Location: https://XXXX.search.windows.net:443/skillsets('test04-index-custom-skillset')?api-version=2023-10-01-Preview
Server: Microsoft-IIS/10.0
Strict-Transport-Security: max-age=2592000, max-age=15724800; includeSubDomains
Preference-Applied: odata.include-annotations="*"
OData-Version: 4.0
request-id: b4b1880e-7391-4e3a-8e6f-736d1279458e
elapsed-time: 75
Date: Tue, 12 Nov 2024 06:01:53 GMT
Connection: close
{
"@odata.context": "https://XXXX.search.windows.net/$metadata#skillsets/$entity",
"name": "test04-index-custom-skillset",
"description": null,
"skills": [
{
"@odata.type": "#Microsoft.Skills.Custom.WebApiSkill",
"name": "custom-embeding-skill",
"description": "Custom-Skill-AzureFunctions",
"context": "/document/pages/*",
"uri": "https://xxxx.azurewebsites.net/api/vectorize",
"httpMethod": "POST",
"timeout": "PT30S",
"batchSize": 1000,
"degreeOfParallelism": null,
"authResourceId": "api://appKey",
"inputs": [
{
"name": "text",
"source": "/document/pages/*",
"sourceContext": null,
"inputs": []
}
],
"outputs": [
{
"name": "vector",
"targetName": "text_vector"
}
],
"httpHeaders": {},
"authIdentity": null
}
],
"cognitiveServices": null,
"knowledgeStore": null,
"indexProjections": {
"selectors": [
{
"targetIndexName": "test02-custom-skill-index",
"parentKeyFieldName": "parent_id",
"sourceContext": "/document/pages/*",
"mappings": [
{
"name": "contentVector",
"source": "/document/pages/*/text_vector",
"sourceContext": null,
"inputs": []
}
]
}
],
"parameters": {
"projectionMode": "skipIndexingParentDocuments"
}
},
"encryptionKey": null
}
authResourceId
本来就在那里,但当我在门户网站上查看时,它已经消失了。