快速入門:使用 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。

提示

如需另一個將 Foundry IQ 部署至 Cosmos DB for NoSQL 並預先設定索引子的 Bicep 範本,請參閱 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 Resource Manager,請參閱以下文章: