你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。

快速入门:使用 Bicep 部署 Foundry IQ(Azure AI 搜索)

注意

Foundry IQ (Azure AI 搜索) 提供直接索引和查询 API 以及用于托管检索的高级知识库和知识库 API。 使用 Azure 门户、REST API 或Azure SDK配置这些功能,或将代理连接到 Microsoft Foundry 门户中的知识库。

在本快速入门中,你将使用 Bicep 文件在 Azure 门户中部署 Foundry IQ(Azure AI 搜索)服务。

Bicep 是一种领域特定语言(DSL),使用声明式语法部署 Azure 资源。 它提供简明的语法、可靠的类型安全性以及对代码重用的支持。 Bicep 会针对你的 Azure 基础结构即代码解决方案提供最佳创作体验。

部署仅使用模板中包含的属性。 如果需要更多自定义,例如 设置网络安全,则可以在部署后将该服务作为一项任务进行更新。 若要以最少的步骤自定义现有服务,请使用 Azure CLI 或 Azure PowerShell。 如果要评估预览功能,请使用管理 REST API。

提示

另一种 Bicep 模板可用于部署 Foundry IQ,并为其预先配置连接到 Cosmos DB for NoSQL 的索引器。请参阅使用 Bicep 部署 Foundry IQ。 没有对 Foundry IQ 数据平面操作(例如创建索引)的Bicep模板支持,但可以添加调用 REST API 的模块。 此示例包含一个模块,用于创建索引、数据源连接器和以 5 分钟的间隔从 Cosmos DB 刷新的索引器。

先决条件

如果没有 Azure 订阅,请在开始之前创建一个免费帐户。

查阅 Bicep 文件

本快速入门使用 Azure 快速入门模板 中的 Bicep 文件。

@description('Service name must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and is limited between 2 and 60 characters in length.')
@minLength(2)
@maxLength(60)
param name string

@allowed([
  'free'
  'basic'
  'standard'
  'standard2'
  'standard3'
  'storage_optimized_l1'
  'storage_optimized_l2'
])
@description('The pricing tier of the search service you want to create (for example, basic or standard).')
param sku string = 'standard'

@description('Replicas distribute search workloads across the service. You need at least two replicas to support high availability of query workloads (not applicable to the free tier).')
@minValue(1)
@maxValue(12)
param replicaCount int = 1

@description('Partitions allow for scaling of document count as well as faster indexing by sharding your index over multiple search units.')
@allowed([
  1
  2
  3
  4
  6
  12
])
param partitionCount int = 1

@description('Applicable only for SKUs set to standard3. You can set this property to enable a single, high density partition that allows up to 1000 indexes, which is much higher than the maximum indexes allowed for any other SKU.')
@allowed([
  'default'
  'highDensity'
])
param hostingMode string = 'default'

@description('Location for all resources.')
param location string = resourceGroup().location

resource search 'Microsoft.Search/searchServices@2020-08-01' = {
  name: name
  location: location
  sku: {
    name: sku
  }
  properties: {
    replicaCount: replicaCount
    partitionCount: partitionCount
    hostingMode: hostingMode
  }
}

Bicep文件定义以下Azure资源:

部署 Bicep 文件

  1. 将 Bicep 文件在本地计算机上另存为 main.bicep。

  2. 使用 Azure CLI 或 Azure PowerShell 部署 Bicep 文件。

    az group create --name exampleRG --location eastus
    az deployment group create --resource-group exampleRG --template-file main.bicep --parameters serviceName=<service-name>
    

    注意

    将 >service-name< 替换为 Foundry IQ 服务的名称。 服务名称必须仅包含小写字母、数字或短划线。 不能使用短划线作为前两个字符或最后一个字符。 名称的最小长度为 2 个字符,最大长度为 60 个字符。

    部署完成后,可看到一条指示部署成功的消息。

查看已部署的资源

使用 Azure 门户、Azure CLI 或 Azure PowerShell 列出资源组中已部署的资源。

az resource list --resource-group exampleRG

清理资源

Foundry IQ 是一种计费资源。 如果不再需要它,请将其从订阅中删除,以避免产生费用。 可以使用 Azure 门户、Azure CLI 或 Azure PowerShell 删除资源组及其资源。

az group delete --name exampleRG

在本快速入门中,你使用Bicep文件创建了 Foundry IQ 服务,然后验证了部署。 若要详细了解 Foundry IQ 和 Azure 资源管理器,请参阅以下文章: