快速入門:使用 Azure Resource Manager 範本部署 Azure AI 搜尋

本文將逐步引導您完成使用 Azure Resource Manager (ARM) 範本在 Azure 入口網站 中部署 Azure AI 搜尋資源的程式。

Azure Resource Manager 範本是 JavaScript 物件表示法 (JSON) 檔案,可定義專案的基礎結構和組態。 範本使用宣告式語法。 您不需要撰寫程式設計命令順序來建立部署,即可描述預定的部署。

部署中只會使用範本中包含的屬性。 如果需要更多自定義,例如 設定網路安全性,您可以將服務更新為部署後工作。 若要使用最少的步驟自定義現有的服務,請使用 Azure CLIAzure PowerShell。 如果您正在評估預覽功能,請使用 管理 REST API

假設您的環境符合必要條件,且您已熟悉使用ARM範本,請選取 [ 部署至 Azure ] 按鈕。 範本會在 Azure 入口網站中開啟。

Button to deploy the Resource Manager template to Azure.

必要條件

如果您沒有 Azure 訂用帳戶,請在開始前建立免費帳戶

檢閱範本

本快速入門中使用的範本是來自 Azure 快速入門範本

{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "metadata": {
    "_generator": {
      "name": "bicep",
      "version": "0.5.6.12127",
      "templateHash": "11257266040777038564"
    }
  },
  "parameters": {
    "name": {
      "type": "string",
      "maxLength": 60,
      "minLength": 2,
      "metadata": {
        "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."
      }
    },
    "sku": {
      "type": "string",
      "defaultValue": "standard",
      "metadata": {
        "description": "The pricing tier of the search service you want to create (for example, basic or standard)."
      },
      "allowedValues": [
        "free",
        "basic",
        "standard",
        "standard2",
        "standard3",
        "storage_optimized_l1",
        "storage_optimized_l2"
      ]
    },
    "replicaCount": {
      "type": "int",
      "defaultValue": 1,
      "maxValue": 12,
      "minValue": 1,
      "metadata": {
        "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)."
      }
    },
    "partitionCount": {
      "type": "int",
      "defaultValue": 1,
      "allowedValues": [
        1,
        2,
        3,
        4,
        6,
        12
      ],
      "metadata": {
        "description": "Partitions allow for scaling of document count as well as faster indexing by sharding your index over multiple search units."
      }
    },
    "hostingMode": {
      "type": "string",
      "defaultValue": "default",
      "allowedValues": [
        "default",
        "highDensity"
      ],
      "metadata": {
        "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."
      }
    },
    "location": {
      "type": "string",
      "defaultValue": "[resourceGroup().location]",
      "metadata": {
        "description": "Location for all resources."
      }
    }
  },
  "resources": [
    {
      "type": "Microsoft.Search/searchServices",
      "apiVersion": "2020-08-01",
      "name": "[parameters('name')]",
      "location": "[parameters('location')]",
      "sku": {
        "name": "[parameters('sku')]"
      },
      "properties": {
        "replicaCount": "[parameters('replicaCount')]",
        "partitionCount": "[parameters('partitionCount')]",
        "hostingMode": "[parameters('hostingMode')]"
      }
    }
  ]
}

此樣本中定義的 Azure 資源:

部署範本

選取以下影像來登入 Azure 並開啟範本。 範本會建立 Azure AI 搜尋資源。

Button to deploy the Resource Manager template to Azure.

入口網站會顯示一個窗體,可讓您輕鬆地提供參數值。 某些參數會預先填入範本中的預設值。 您必須提供訂用帳戶、資源群組、位置和服務名稱。 如果您想要在 AI 擴充管線中使用 Azure AI 服務,例如分析文字的二進位圖像檔案,請選擇同時提供 Azure AI 搜尋和 Azure AI 服務的位置。 這兩項服務都必須位於相同區域中,才能使用 AI 擴充工作負載。 完成表單之後,您必須同意條款及條件,然後選取 [購買] 按鈕來完成部署。

Azure portal display of template

檢閱已部署的資源

當您的部署完成時,您可以在入口網站中存取新的資源群組和新的搜尋服務。

清除資源

本快速入門所建置的其他 Azure AI 搜尋快速入門和教學課程。 如果您打算繼續使用後續的快速入門和教學課程,建議您保留此資源。 不再需要時,您可以刪除資源群組,以刪除 Azure AI 搜尋服務 和相關資源。

下一步

在本快速入門中,您已使用ARM範本建立 Azure AI 搜尋服務,並驗證部署。 若要深入瞭解 Azure AI 搜尋和 Azure Resource Manager,請繼續閱讀下列文章。