0

有用于预配两个 Azure 搜索服务的 ARM 模板

"resources": [
{
  "type": "Microsoft.Search/searchServices",
  "name": "[parameters('serviceName')]",
  "apiVersion": "[parameters('serviceApiVersion')]",
  "location": "[parameters('location')]",
  "properties": {
    "sku": {
      "name": "[parameters('sku')]"
    },
    "replicaCount": 1,
    "partitionCount": 1,
    "hostingMode": "[parameters('hostingMode')]"
  }
},
{
  "type": "Microsoft.Search/searchServices",
  "name": "[concat(parameters('serviceName'), 'secondary')]",
  "apiVersion": "[parameters('serviceApiVersion')]",
  "location": "[parameters('location')]",
  "properties": {
    "sku": {
      "name": "[parameters('sku')]"
    },
    "replicaCount": 1,
    "partitionCount": 1,
    "hostingMode": "[parameters('hostingMode')]"
  }
}]

ARM 模板的部署提供了一个搜索服务,而另一个搜索服务失败并响应:

{
  "error": {
    "code": "Unknown",
    "message": "There was a conflicting update. No change was made to the resource from this request. RequestId: b65a51b5-cd87-4dc5-82d9-9041ddd1c2dc",
    "target": null,
    "details": null
  }
}

有没有人面临这样的问题?

4

2 回答 2

2

可能无法在同一资源组中同时提供搜索服务。尝试将“dependsOn”属性添加到第二个搜索服务。

于 2016-08-11T15:33:51.620 回答
0

问题

搜索服务不依赖于其他服务,因此dependsOn不需要属性。
我认为问题在于您的 arm语法无效

我不知道您使用的是哪个 apiVersion,但我找不到任何具有相同语法的...(它最类似于 2015-02-28,但该hostingMode字段不允许在那里)。

解决方案

要么不使用 apiVersion 2015-02-28,hostingmode要么(如果您需要该字段)使用更新的 apiVersion,其中“sku”位于“属性”之外。以下对我有用!

{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "resources": [
  {
    "type": "Microsoft.Search/searchServices",
    "name": "parameters('serviceName')",
    "apiVersion": "2015-08-19",
    "location": "parameters('location')",
    "properties": {
      "replicaCount": 1,
      "partitionCount": 1,
      "hostingMode": "default"
    },
    "sku": {
      "name": "basic"
    }
  },
  {
    "type": "Microsoft.Search/searchServices",
    "name": "[concat(parameters('serviceName'), 'secondary')]"
    "apiVersion": "2015-08-19",
    "location": "parameters('location')",
    "properties": {
      "replicaCount": 1,
      "partitionCount": 1,
      "hostingMode": "default"
    },
    "sku": {
      "name": "basic"
    }
  }]
}

于 2020-10-10T18:08:44.037 回答