你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
注意
Foundry IQ (Azure AI 搜索) 提供直接索引和查询 API 以及用于托管检索的高级知识库和知识库 API。 使用 Azure 门户、REST API 或Azure SDK配置这些功能,或将代理连接到 Microsoft Foundry 门户中的知识库。
blob 知识源将Azure Blob 存储或 ADLS Gen2 内容引入 Foundry IQ(Azure AI 搜索)中的代理检索管道。 知识源是独立创建的,在知识库中引用,并在知识库在运行时被查询时用作基础数据。
创建 Blob 知识源时,指定外部数据源、模型和属性以自动生成以下 Foundry IQ 对象:
- 表示 Blob 容器的数据源。
- 一个技能组,用于将多模态内容从容器中分块和选择性地向量化。
- 存储扩充内容并满足代理检索条件的索引。
- 使用前面的对象驱动索引和扩充管道的索引器。
生成的索引 器符合 Blob 索引器,其先决条件、支持的文档格式和限制也适用于 Blob 知识源。 有关详细信息,请参阅 Blob 索引器文档 和 索引器限制。 如果生成的技能集调用外部服务,该技能的输入和服务限制也适用。
使用支持
| Azure 门户 | Microsoft Foundry 门户 | .NET SDK | Python SDK | Java SDK | JavaScript SDK | REST API |
|---|---|---|---|---|---|---|
| ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
先决条件
在提供智能体检索的任意区域中的 Foundry IQ 服务。
一个 Blob 容器,支持文本内容的内容类型。 对于可选的图像语言化,支持的内容类型取决于聊天完成模型是否可以分析和描述图像文件。
如果
standard为contentExtractionMode,请使用位于 Foundry Tools 中内容理解支持的区域内且具有https://<resource-name>.services.ai.azure.com终结点的 Microsoft Foundry 资源。 该资源必须具有嵌入模型部署;如果启用了图像描述功能,还必须具有多模态聊天模型部署。创建知识源的权限。 使用分配给用户帐户的搜索服务参与者和搜索索引数据参与者角色(建议)或使用管理员 API 密钥配置无密钥身份验证。
Foundry IQ 服务的托管标识,在源存储帐户范围内具有存储 Blob 数据读取者角色,并在 Microsoft Foundry 资源上具有认知服务用户角色。 若在不同的存储帐户中配置资产存储,还需在该存储帐户范围内分配 Storage Blob Data Contributor 角色。 如果源容器和资产容器属于同一帐户,存储 Blob 数据参与者 同时提供对源的读取访问权限以及对资产存储的读/写访问权限。
- 对于使用托管标识调用 Azure OpenAI 嵌入或部署的情况,请在匹配
resourceUri的 Azure OpenAI 或父级 Foundry 资源上,为所选标识分配认知服务 OpenAI 用户。 提取服务权限是分开的。 请参阅分配角色。
- 对于使用托管标识调用 Azure OpenAI 嵌入或部署的情况,请在匹配
如果将
networkAccessMode设置为private,请完成以下要求:使用 S2、S3、L1 或 L2 Foundry IQ 服务。 检查规范 共享专用链接支持矩阵 ,了解配置和层资格。
在 Foundry IQ 服务上启用系统分配的或用户分配的托管标识,在存储帐户上授予存储 Blob 数据读取者角色,并使用
ResourceId=/subscriptions/<subscription-id>/resourceGroups/<resource-group>/providers/Microsoft.Storage/storageAccounts/<storage-account>连接字符串。 对于用户分配的标识,还设置ingestionParameters.identity。创建并审批受支持的资源类型下列出的存储链接。 对于 ADLS Gen2,需要链接
blob和dfs链接。为配置使用的每个受保护模型、提取、扩充或资产存储依赖项创建和批准链接。 请针对每个目标和组 ID,遵循支持的资源类型。
所需
Azure.Search.Documents软件包:对于
2026-08-01-preview功能,最新的预览包:dotnet add package Azure.Search.Documents --prerelease对于
2026-10-01,最新的稳定包:dotnet add package Azure.Search.Documents
对于无密钥身份验证,请使用
Azure.Identity软件包:dotnet add package Azure.Identity
所需
azure-search-documents软件包:对于
2026-08-01-preview功能,最新的预览包:pip install --pre azure-search-documents对于
2026-10-01,最新的稳定包:pip install azure-search-documents
对于无密钥身份验证,请使用
azure-identity软件包:pip install azure-identity
所需的搜索服务 REST API 版本:
对于预览功能: 2026-11-01-preview
对于正式发布的功能(包括专用引入数据):2026-10-01
对于无密钥身份验证,请在每个 HTTP 请求的标头中包含
AuthorizationMicrosoft Entra ID令牌。
对于权限引入处理,请使用 REST2026-10-01,如强制实施文档级权限中所示。 稳定版2026-04-01 SDK 示例未配置权限提取。 检查包更改日志,确认是否支持所需的 API 版本和属性。
REST 示例使用最新的预览 API 2026-11-01-preview。 预览版 SDK 示例保留其文档中说明的 2026-08-01-preview 契约。 在面向较新的 API 版本之前,请检查包更改日志。
检查现有知识源
知识源是顶级可重用对象。 了解现有知识源有助于重复使用或命名新对象。
运行以下代码,按名称和类型列出知识源。
// List knowledge sources by name and type
using Azure.Search.Documents.Indexes;
var indexClient = new SearchIndexClient(new Uri(searchEndpoint), credential);
var knowledgeSources = indexClient.GetKnowledgeSourcesAsync();
Console.WriteLine("Knowledge Sources:");
await foreach (var ks in knowledgeSources)
{
Console.WriteLine($" Name: {ks.Name}, Type: {ks.GetType().Name}");
}
# List knowledge sources by name and type
from azure.core.credentials import AzureKeyCredential
from azure.search.documents.indexes import SearchIndexClient
index_client = SearchIndexClient(endpoint = "search_url", credential = AzureKeyCredential("api_key"))
for ks in index_client.list_knowledge_sources():
print(f" - {ks.name} ({ks.kind})")
### List knowledge sources by name and type
GET {{search-url}}/knowledgesources?api-version={{api-version}}&$select=name,kind
Authorization: Bearer {{token}}
参考:知识源 - 列表
还可以按名称返回单个知识源以查看其 JSON 定义。
using Azure.Search.Documents.Indexes;
using System.Text.Json;
var indexClient = new SearchIndexClient(new Uri(searchEndpoint), credential);
// Specify the knowledge source name to retrieve
string ksNameToGet = "earth-knowledge-source";
// Get its definition
var knowledgeSourceResponse = await indexClient.GetKnowledgeSourceAsync(ksNameToGet);
var ks = knowledgeSourceResponse.Value;
// Serialize to JSON for display
var jsonOptions = new JsonSerializerOptions
{
WriteIndented = true,
DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.Never
};
Console.WriteLine(JsonSerializer.Serialize(ks, ks.GetType(), jsonOptions));
# Get a knowledge source definition
from azure.core.credentials import AzureKeyCredential
from azure.search.documents.indexes import SearchIndexClient
import json
index_client = SearchIndexClient(endpoint = "search_url", credential = AzureKeyCredential("api_key"))
ks = index_client.get_knowledge_source("knowledge_source_name")
print(json.dumps(ks.as_dict(), indent = 2))
### Get a knowledge source definition
GET {{search-url}}/knowledgesources('{{knowledge-source-name}}')?api-version={{api-version}}
Authorization: Bearer {{token}}
参考:知识源 - 获取
以下响应会对敏感值进行脱敏处理,并在 createdResources 下列出生成的对象。 在重用它以创建另一个知识源之前,请提供目标凭据或配置受支持的托管标识;已脱敏的值不是凭据。
{
"name": "my-blob-ks",
"kind": "azureBlob",
"description": "A sample blob knowledge source.",
"encryptionKey": null,
"azureBlobParameters": {
"connectionString": "<REDACTED>",
"containerName": "blobcontainer",
"folderPath": null,
"isADLSGen2": false,
"ingestionParameters": {
"disableImageVerbalization": false,
"ingestionPermissionOptions": [],
"contentExtractionMode": "standard",
"identity": null,
"embeddingModel": {
"kind": "azureOpenAI",
"azureOpenAIParameters": {
"resourceUri": "<REDACTED>",
"deploymentId": "text-embedding-3-large",
"modelName": "text-embedding-3-large",
"authIdentity": null
}
},
"chatCompletionModel": {
"kind": "azureOpenAI",
"azureOpenAIParameters": {
"resourceUri": "<aoai-endpoint>",
"deploymentId": "gpt-5-mini",
"modelName": "gpt-5-mini",
"authIdentity": null
}
},
"ingestionSchedule": null,
"assetStore": null,
"aiServices": {
"uri": "<aoai-endpoint>"
}
},
"createdResources": {
"datasource": "my-blob-ks-datasource",
"indexer": "my-blob-ks-indexer",
"skillset": "my-blob-ks-skillset",
"index": "my-blob-ks-index"
}
}
}
创建知识源
通过使用 REST API2026-11-01-preview,嵌入和聊天引入模型支持Azure API 管理(APIM) 高级 v2 终结点。 内容理解提取不支持 APIM 终结点。
运行以下代码以创建 Blob 知识源。
// Create a blob knowledge source
using Azure.Search.Documents.Indexes;
using Azure.Search.Documents.Indexes.Models;
using Azure.Search.Documents.KnowledgeBases.Models;
using Azure.Search.Documents.Models;
using Azure.Identity;
var indexClient = new SearchIndexClient(new Uri(searchEndpoint), new DefaultAzureCredential());
var chatCompletionParams = new AzureOpenAIVectorizerParameters
{
ResourceUri = new Uri(aoaiEndpoint),
DeploymentName = aoaiGptDeployment,
ModelName = aoaiGptModel
};
var embeddingParams = new AzureOpenAIVectorizerParameters
{
ResourceUri = new Uri(aoaiEndpoint),
DeploymentName = aoaiEmbeddingDeployment,
ModelName = aoaiEmbeddingModel
};
var ingestionParams = new KnowledgeSourceIngestionParameters
{
NetworkAccessMode = KnowledgeSourceNetworkAccessMode.Public,
DisableImageVerbalization = false,
ChatCompletionModel = new KnowledgeBaseAzureOpenAIModel(azureOpenAIParameters: chatCompletionParams),
EmbeddingModel = new KnowledgeSourceAzureOpenAIVectorizer
{
AzureOpenAIParameters = embeddingParams
},
IngestionPermissionOptions = new List<KnowledgeSourceIngestionPermissionOption>
{
KnowledgeSourceIngestionPermissionOption.RbacScope
}
};
var blobParams = new AzureBlobKnowledgeSourceParameters(
connectionString: connectionString,
containerName: containerName
)
{
IsAdlsGen2 = false,
IngestionParameters = ingestionParams
};
var knowledgeSource = new AzureBlobKnowledgeSource(
name: "my-blob-ks",
azureBlobParameters: blobParams
)
{
Description = "This knowledge source pulls from a blob storage container."
};
await indexClient.CreateOrUpdateKnowledgeSourceAsync(knowledgeSource);
Console.WriteLine($"Knowledge source '{knowledgeSource.Name}' created or updated successfully.");
# Create a blob knowledge source
from azure.identity import DefaultAzureCredential
from azure.search.documents.indexes import SearchIndexClient
from azure.search.documents.indexes.models import AzureBlobKnowledgeSource, AzureBlobKnowledgeSourceParameters, KnowledgeBaseAzureOpenAIModel, AzureOpenAIVectorizerParameters, KnowledgeSourceAzureOpenAIVectorizer, KnowledgeSourceContentExtractionMode, KnowledgeSourceIngestionParameters
from azure.search.documents.knowledgebases.models import KnowledgeSourceNetworkAccessMode
index_client = SearchIndexClient(endpoint = "<search-endpoint>", credential = DefaultAzureCredential())
knowledge_source = AzureBlobKnowledgeSource(
name = "my-blob-ks",
description = "This knowledge source pulls from a blob storage container.",
encryption_key = None,
azure_blob_parameters = AzureBlobKnowledgeSourceParameters(
connection_string = "blob_connection_string",
container_name = "blob_container_name",
folder_path = None,
is_adls_gen2 = False,
ingestion_parameters = KnowledgeSourceIngestionParameters(
network_access_mode = KnowledgeSourceNetworkAccessMode.PUBLIC,
identity = None,
disable_image_verbalization = False,
chat_completion_model = KnowledgeBaseAzureOpenAIModel(
azure_open_ai_parameters = AzureOpenAIVectorizerParameters(
resource_url = "<aoai-endpoint>",
deployment_name = "<aoai-gpt-deployment>",
model_name = "<aoai-gpt-model>",
)
),
embedding_model = KnowledgeSourceAzureOpenAIVectorizer(
azure_open_ai_parameters=AzureOpenAIVectorizerParameters(
resource_url = "<aoai-endpoint>",
deployment_name = "<aoai-embedding-deployment>",
model_name = "<aoai-embedding-model>",
)
),
content_extraction_mode = KnowledgeSourceContentExtractionMode.MINIMAL,
ingestion_schedule = None,
ingestion_permission_options = ["rbacScope"]
)
)
)
index_client.create_or_update_knowledge_source(knowledge_source)
print(f"Knowledge source '{knowledge_source.name}' created or updated successfully.")
### Create a blob knowledge source
PUT {{search-endpoint}}/knowledgesources/my-blob-ks?api-version=2026-11-01-preview
Authorization: Bearer {{search-access-token}}
Content-Type: application/json
{
"name": "my-blob-ks",
"kind": "azureBlob",
"description": "This knowledge source pulls from a blob storage container.",
"encryptionKey": null,
"azureBlobParameters": {
"connectionString": "ResourceId=<storage-resource-id>",
"containerName": "<blob-container-name>",
"folderPath": null,
"isADLSGen2": false,
"ingestionParameters": {
"networkAccessMode": "public",
"identity": null,
"disableImageVerbalization": null,
"chatCompletionModel": {
"kind": "azureOpenAI",
"azureOpenAIParameters": {
"resourceUri": "{{aoai-endpoint}}",
"deploymentId": "{{aoai-gpt-deployment}}",
"modelName": "{{aoai-gpt-model}}"
}
},
"embeddingModel": {
"kind": "azureOpenAI",
"azureOpenAIParameters": {
"resourceUri": "{{aoai-endpoint}}",
"deploymentId": "{{aoai-embedding-deployment}}",
"modelName": "{{aoai-embedding-model}}"
}
},
"contentExtractionMode": "minimal",
"ingestionSchedule": null,
"ingestionPermissionOptions": ["rbacScope"]
}
}
}
参考:知识源 - 创建或更新
配置摄取计划
设置 ingestionParameters.ingestionSchedule,以控制生成的索引器轮询源更改情况的频率。 符合条件的未完成引入可以在执行时间停止后自动继续 ,而无需等待下一轮投票。
配置标准提取
若要使用内容理解进行布局提取和语义分块,而不是前面示例中的minimal提取,请将contentExtractionMode设置为standard,并使用您的 Foundry 资源端点配置aiServices。 使用先决条件中所述的资源和部署。
标准提取会产生内容理解费用,并在启用图像语言化时产生模型使用费用。 有关详细信息,请参阅 计费和映像说明控件。
将数据摄取限制在私有网络内
在稳定的 2026-10-01 API 中, networkAccessMode 控制为 Blob 知识源运行生成的索引器的网络环境。 此设置仅影响引入,不会更改知识库检索请求或响应。 检查 共享专用链接支持矩阵 中是否有符合条件的配置。 独立的预览功能(如自动每语言分析器和图像服务)保留了自己的 API 要求。
networkAccessMode默认为public保留现有公共网络行为。 如果 networkAccessMode 为 private,生成的索引器在 专用执行环境中运行。 它使用批准的共享专用链接访问 Azure Blob 存储 或 ADLS Gen2 源连接,并支持Azure依赖项,例如Azure OpenAI 模型和 Microsoft Foundry 资源。
配置和验证专用网络访问:
完成 专用网络先决条件。
在知识源创建请求中,将
networkAccessMode设置为private。 只能在创建期间设置此属性,包括在稳定的2026-10-01API 中。 若要稍后更改存储模式,请删除并重新创建知识源。 符合条件的 Blob、ADLS Gen2 和 Azure SQL 源可以改用临时生成的索引器网络覆盖。 该异常不适用于索引SharePoint或其他源类型。如果服务层或运行时不支持专用执行,或者所需的共享专用链接不存在,则创建可能会失败。 无服务器和 S3 HD 不支持私有执行。 网络安全外围配置控制受支持的公共终结点访问,而非专用执行。
确认生成的索引器
parameters.configuration.executionEnvironment为private.确认每个必需的共享专用链接都已获得批准、预配并针对正确的依赖项。 仅凭成功创建并不能确认链接已获批准或定向设置已生效。 如果门户检查无法解析跨订阅资源,请手动验证目标资源和 Foundry IQ 服务的审批和准备情况。
轮询知识源状态,直到
lastSynchronizationState.endTime具有值。 确认itemsUpdatesFailed为0,然后验证特定于连接器的源内容。 如果无法访问依赖项,同步将失败。
使用按语言自动选择的分析器(预览版)
从 2026-08-01-preview API 版本开始,针对 Blob、已编制索引的 OneLake 以及已编制索引的 SharePoint 知识源提供了按语言的自动分析器。 启用后,Foundry IQ(Azure AI 搜索)会检测每个源文档的语言,并自动应用与之匹配的 Microsoft 语言分析器。 不会在知识源定义或查询中指定分析器。
若要启用每种语言的自动分析器,请在知识源定义中设置为contentExtractionModeminimal和配置ingestionParameters.aiServices。
对于无密钥身份验证,请省略 aiServices.apiKey,并在 Microsoft Foundry 资源上将 认知服务用户角色分配给 Foundry IQ 服务的托管标识。 对于基于密钥的身份验证,请将 aiServices.apiKey 设置为您的 Foundry 资源的有效密钥。
支持以下语言:
- English
- 日语
- French
- Spanish
- German
- 荷兰语
- Italian
- 巴西葡萄牙语
- 欧洲葡萄牙语
- 简体中文
- 繁体中文
- Korean
对于多语言内容,Foundry IQ 会根据检测到的主要语言选择分析器。 当语言不受支持或不确定时,它使用标准分析器。
启用自动每种语言分析器时,Foundry IQ 会将每个受支持的语言的语言特定内容字段添加到生成的索引架构中,无论数据是否包含这些语言中的文档。 在摄取过程中,文档会根据检测到的语言被路由到相应的语言专用字段。
未使用的语言字段不包含索引内容,并且存储影响最小,但它们仍然是索引架构的一部分,并计入索引字段限制。 规划索引设计、字段计数和存储要求时,请考虑其他字段。 有关详细信息,请参阅 索引限制 和 估算和管理 Foundry IQ 服务的容量。
语言检测 在免费 AI 扩充分配后计费。 有关详细信息,请参阅 免费扩充。
数据引入后,验证语言路由而不编辑生成的对象:
- 检查生成的索引架构。 确认特定于语言的字段具有与其匹配的分析器,例如
snippet_en与en.microsoft,并且snippet_default提供标准分析器回退。 - 确认生成的语义配置列出了特定于语言的内容字段和
snippet_default。 - 检查被检测为受支持语言的文档的索引区块。 每个区块的文本都属于相应的语言字段。 不支持或不确定的检测会将文本路由到
snippet_default。 - 从已填充的语言字段或回退字段读取内容。 在此模式下,生成的架构不包含单独的
snippet字段。
如果架构或结果不匹配,请查看上述激活设置和 索引器错误。 这些检查不会为现有生成的索引定义更新或迁移过程。
检查摄取状态
运行以下代码来监视引入进度和运行状况,包括知识源类型以及生成索引器管道并填充搜索索引的知识源的详细索引错误。
using Azure.Search.Documents.Indexes;
using System.Text.Json;
var indexClient = new SearchIndexClient(new Uri(searchEndpoint), new AzureKeyCredential(apiKey));
// Get knowledge source ingestion status
var statusResponse = await indexClient.GetKnowledgeSourceStatusAsync(knowledgeSourceName);
var status = statusResponse.Value;
// Serialize to JSON for display
var json = JsonSerializer.Serialize(status, new JsonSerializerOptions { WriteIndented = true });
Console.WriteLine(json);
# Check knowledge source ingestion status
from azure.core.credentials import AzureKeyCredential
from azure.search.documents.indexes import SearchIndexClient
import json
index_client = SearchIndexClient(endpoint="search_url", credential=AzureKeyCredential("api_key"))
status = index_client.get_knowledge_source_status("knowledge_source_name")
print(json.dumps(status.as_dict(), indent=2))
### Check knowledge source ingestion status
GET {{search-url}}/knowledgesources/{{knowledge-source-name}}/status?api-version={{api-version}}
Authorization: Bearer {{token}}
Content-Type: application/json
参考:知识源 - 获取状态
包含引入参数且正在主动引入内容的请求的响应可能如以下示例所示。
{
"kind": "azureBlob",
"synchronizationStatus": "active",
"synchronizationInterval": "1d",
"currentSynchronizationState": {
"startTime": "2026-04-10T19:30:00Z",
"itemUpdatesProcessed": 1100,
"itemsUpdatesFailed": 100,
"itemsSkipped": 1100,
"errors": [
{
"key": "Item id 1",
"docURL": "https://contoso.blob.core.windows.net/contracts/2024/Q4/doc-00023.csv",
"statusCode": 400,
"componentName": "DocumentExtraction.AzureBlob.MyDataSource",
"errorMessage": "Could not read the value of column 'foo' at index '0'.",
"details": "The file could not be parsed.",
"documentationLink": "https://go.microsoft.com/fwlink/?linkid=2049388"
}
]
},
"lastSynchronizationState": {
"status": "partialSuccess",
"startTime": "2026-04-09T19:30:00Z",
"endTime": "2026-04-09T19:40:01Z",
"itemUpdatesProcessed": 1100,
"itemsUpdatesFailed": 100,
"itemsSkipped": 1100,
"errors": null
},
"statistics": {
"totalSynchronizations": 25,
"averageSynchronizationDuration": "00:15:20",
"averageItemsProcessedPerSynchronization": 500
}
}
注意
从 2026-04-01 API 版本开始,文档级错误详细信息的 kind 属性和 currentSynchronizationState.errors[] 数组即可使用。 对于早期 API 版本,不会返回这些字段。 该 lastSynchronizationState.status 字段也是 2026-04-01 中的新增字段。
查看生成的对象
创建此知识源时,Foundry IQ(Azure AI 搜索)会自动生成数据源、索引器和索引,并在引入管道需要时生成技能集。 创建响应将列出下 createdResources的每个对象。
这些对象根据固定模板生成,其名称基于知识源的名称。 无法更改对象名称。 避免直接编辑这些对象,因为更改可能会引入中断索引器管道的错误或不兼容。
对于符合条件的 Blob、ADLS Gen2 和Azure SQL源,临时网络替代允许更改生成的索引器的执行环境。 此异常不适用于索引SharePoint或 OneLake,并且不允许其他生成的对象更改。 后续的知识源更新或重新生成可能会覆盖该覆盖项。
可以使用Azure门户验证对象创建。 工作流为:
检查索引器是否有成功或失败的消息。 这里会显示连接错误或配额错误。
检查数据源以验证与数据存储的连接。 该连接使用连接字符串或托管标识,具体取决于你如何配置知识源。
如果生成技能集,请检查其扩充和矢量化设置。 仅当指定
embeddingColumns时,SQL 知识源才会生成技能集。检查索引以了解您的内容是如何被编制索引和公开以供检索的,包括哪些字段可供搜索和筛选,以及哪些字段存储用于相似性搜索的向量。 使用搜索资源管理器针对生成的索引运行查询。
将生成的数据源、索引器、索引和技能集(如果存在)视为一个引入配置。 限制谁可以更改该配置或将文档发布到其索引。 生成的标识符和权限字段名称不能确立文档所有权,也不能使普通内容成为授权授予的有效来源。 遵循预防性摄取指南 和文档规定的自定义边界;不要将对生成的键或映射进行任意直接编辑用作所有权控制。
分配给知识库
如果对知识源感到满意, 请将其添加到知识库。
查询知识库
配置知识库后, 调用检索操作或 MCP 终结点 来查询知识源。 选择与方案匹配的配置。
强制实施文档级权限
使用支持的默认提取选项(contentExtractionMode: "minimal")或基于内容理解的标准提取(contentExtractionMode: "standard")。 每个生成的区块都会保留源项的权限元数据和源上下文。 文档级权限不支持客户选择的专用解析模式。 有关权限引入,请参阅支持的分析和内容提取。 在知识源上配置这些选项;不要更改已生成的解析器设置。
使用 REST API ingestionPermissionOptions 创建知识源时设置 2026-10-01:
- 对于标准 Blob 存储,请将
isADLSGen2设置为false,并请求rbacScope。 请参阅 完整的 Blob REST 配置。 - 对于 ADLS Gen2,将
isADLSGen2设置为true,并请求获取userIds、groupIds和rbacScope。 从 ADLS REST 配置开始,并将rbacScope添加到其ingestionPermissionOptions数组中,以引入 ACL 和容器 RBAC 范围。
生成的索引包括 metadata_storage_path 和配置的权限字段,并包含针对投影区块的映射。 ADLS 权限引入需要路径,包括仅限 RBAC 的引入。 它在生成的标准 Blob 架构中的存在并不意味着它是计算直接 Blob 索引器容器范围所必需的。
一起查看生成的索引、技能集投影和索引器。 在每个受保护的区块上保留源路径上下文和权威权限映射。 对于缺少值的现有记录,仅更正架构不会回填元数据;遵循 架构和投影修正。
生成的 ADLS 索引器遵循 自动 ACL 刷新设置和节奏。 在生成的索引器上配置 parameters.configuration.refreshAllAcls 。 对于按需刷新,请在 权限重新同步过程中使用该索引器的名称。
在检索请求中包含委托用户的访问令牌。 有关请求标头,请参阅 在查询时强制实施权限。
显示文档嵌入图像(预览版)
若要在答案合成响应中显示文档嵌入的图像(如图表或扫描),请对此知识源进行配置 assetStore ,然后在知识库上启用图像服务。 配置了 ingestionPermissionOptions 时,不支持图像服务。 有关详细信息,请参阅代理检索中Surface文档嵌入图像(预览版)。
删除知识源
在删除知识库之前,必须删除引用它的任何知识库或更新知识库定义以删除引用。 对于生成索引和索引器管道的知识源,也会删除所有 生成的对象 。 但是,如果使用现有索引创建知识源,则不会删除索引。
如果尝试删除正在使用的知识源,该操作将失败并返回受影响的知识库列表。
删除知识源:
获取 Foundry IQ 服务上的所有知识库的列表。
using Azure.Search.Documents.Indexes; var indexClient = new SearchIndexClient(new Uri(searchEndpoint), credential); var knowledgeBases = indexClient.GetKnowledgeBasesAsync(); Console.WriteLine("Knowledge Bases:"); await foreach (var kb in knowledgeBases) { Console.WriteLine($" - {kb.Name}"); }示例响应可能如下所示:
{ "@odata.context": "https://my-search-service.search.windows.net/$metadata#knowledgebases(name)", "value": [ { "name": "my-kb" }, { "name": "my-kb-2" } ] }获取单个知识库定义以检查知识源引用。
using Azure.Search.Documents.Indexes; using System.Text.Json; var indexClient = new SearchIndexClient(new Uri(searchEndpoint), credential); // Specify the knowledge base name to retrieve string kbNameToGet = "earth-knowledge-base"; // Get a specific knowledge base definition var knowledgeBaseResponse = await indexClient.GetKnowledgeBaseAsync(kbNameToGet); var kb = knowledgeBaseResponse.Value; // Serialize to JSON for display string json = JsonSerializer.Serialize(kb, new JsonSerializerOptions { WriteIndented = true }); Console.WriteLine(json);示例响应可能如下所示:
{ "Name": "earth-knowledge-base", "KnowledgeSources": [ { "Name": "earth-knowledge-source" } ], "Models": [ {} ], "RetrievalReasoningEffort": {}, "OutputMode": {}, "ETag": "\u00220x8DE278629D782B3\u0022", "EncryptionKey": null, "Description": null, "RetrievalInstructions": null, "AnswerInstructions": null }删除知识库,或者如果有多个知识库,请更新知识库以删除源。 此示例显示删除。
using Azure.Search.Documents.Indexes; var indexClient = new SearchIndexClient(new Uri(searchEndpoint), credential); await indexClient.DeleteKnowledgeBaseAsync(knowledgeBaseName); System.Console.WriteLine($"Knowledge base '{knowledgeBaseName}' deleted successfully.");删除知识源。
await indexClient.DeleteKnowledgeSourceAsync(knowledgeSourceName); System.Console.WriteLine($"Knowledge source '{knowledgeSourceName}' deleted successfully.");
获取 Foundry IQ 服务上的所有知识库的列表。
# Get knowledge bases from azure.core.credentials import AzureKeyCredential from azure.search.documents.indexes import SearchIndexClient index_client = SearchIndexClient(endpoint = "search_url", credential = AzureKeyCredential("api_key")) print("Knowledge Bases:") for kb in index_client.list_knowledge_bases(): print(f" - {kb.name}")示例响应可能如下所示:
{ "@odata.context": "https://my-search-service.search.windows.net/$metadata#knowledgebases(name)", "value": [ { "name": "my-kb" }, { "name": "my-kb-2" } ] }获取单个知识库定义以检查知识源引用。
# Get a knowledge base definition from azure.core.credentials import AzureKeyCredential from azure.search.documents.indexes import SearchIndexClient index_client = SearchIndexClient(endpoint = "search_url", credential = AzureKeyCredential("api_key")) kb = index_client.get_knowledge_base("knowledge_base_name") print(kb)示例响应可能如下所示:
{ "name": "my-kb", "description": null, "retrievalInstructions": null, "answerInstructions": null, "outputMode": null, "knowledgeSources": [ { "name": "my-blob-ks" } ], "models": [], "encryptionKey": null, "retrievalReasoningEffort": { "kind": "low" } }删除知识库,或者如果有多个知识库,请更新知识库以删除源。 此示例显示删除。
# Delete a knowledge base from azure.core.credentials import AzureKeyCredential from azure.search.documents.indexes import SearchIndexClient index_client = SearchIndexClient(endpoint = "search_url", credential = AzureKeyCredential("api_key")) index_client.delete_knowledge_base("knowledge_base_name") print(f"Knowledge base deleted successfully.")删除知识源。
# Delete a knowledge source from azure.core.credentials import AzureKeyCredential from azure.search.documents.indexes import SearchIndexClient index_client = SearchIndexClient(endpoint = "search_url", credential = AzureKeyCredential("api_key")) index_client.delete_knowledge_source("knowledge_source_name") print(f"Knowledge source deleted successfully.")
获取 Foundry IQ 服务上的所有知识库的列表。
### Get knowledge bases GET {{search-url}}/knowledgebases?api-version={{api-version}}&$select=name Authorization: Bearer {{token}}参考:知识库 - 列表
示例响应可能如下所示:
{ "@odata.context": "https://my-search-service.search.windows.net/$metadata#knowledgebases(name)", "value": [ { "name": "my-kb" }, { "name": "my-kb-2" } ] }获取单个知识库定义以检查知识源引用。
### Get a knowledge base definition GET {{search-url}}/knowledgebases('{{knowledge-base-name}}')?api-version={{api-version}} Authorization: Bearer {{token}}参考:知识库 - 获取
示例响应可能如下所示:
{ "name": "my-kb", "description": null, "retrievalInstructions": null, "answerInstructions": null, "outputMode": null, "knowledgeSources": [ { "name": "my-blob-ks" } ], "models": [], "encryptionKey": null, "retrievalReasoningEffort": { "kind": "low" } }删除知识库,或者如果有多个知识库,请更新知识库以删除源。 此示例显示删除。
### Delete a knowledge base DELETE {{search-url}}/knowledgebases('{{knowledge-base-name}}')?api-version={{api-version}} Authorization: Bearer {{token}}参考:知识库 - 删除
删除知识源。
### Delete a knowledge source DELETE {{search-url}}/knowledgesources('{{knowledge-source-name}}')?api-version={{api-version}} Authorization: Bearer {{token}}参考:知识源 - 删除