Azure AI 搜索自定义技能,无法将 authResourceId 保留在技能集中

问题描述 投票:0回答:1

我尝试从 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上保存技能集后该功能消失了。当然,由于身份验证,对该功能的请求会失败。

enter image description here

https://learn.microsoft.com/en-us/azure/search/cognitive-search-custom-skill-web-api

在门户上保存后我的技能定义。保存时没有错误信息。

enter image description here

然后重新打开相同的技能组。

authResourceId
消失了。在调试会话中保存编辑的技能设置后也会发生这种情况。

enter image description here

如果我禁用 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
本来就在那里,但当我在门户网站上查看时,它已经消失了。

enter image description here

azure azure-ai-search
1个回答
0
投票

根据文档使用

authResourceId
参数,您需要使用
api-version=2023-10-01-Preview
调用API。

我得到了同样的结果,保存技能组后,当我刷新时它不可见。但您使用 REST API 更新技能组,版本为

2023-10-01-Preview

以下是我测试的样本。

enter image description here

接下来,它在门户中将不可见,这可能是由于门户用于配置搜索服务的 Api 版本所致。

您使用其余 Api 本身列出技能组,您将获得正确的配置。

enter image description here

现在您尝试运行索引器,它将起作用,请确保在添加身份提供程序时按照此文档正确配置了所有内容。

© www.soinside.com 2019 - 2024. All rights reserved.