使用ARM模板使用招摇链接更新Azure Api管理中的操作

时间:2019-04-07 17:20:44

标签: azure azure-resource-manager

我想使用ARM模板使用招摇链接来更新API的操作。当我运行下面的ARM模板时,出现错误

  

“错误”:{“代码”:“ InvalidRequestContent”,“消息”:“请求   内容无效,无法反序列化:“找不到   类型“ DeploymentPropertiesDefinition”的对象上的成员“ dependsOn”。   路径'properties.dependsOn',第1行,位置734。'。”

https://docs.microsoft.com/en-us/azure/templates/microsoft.apimanagement/2018-06-01-preview/service/apis

{
    "$schema":
        "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
  "parameters": {
    "ApimServiceName": {
      "type": "string"
    },
    "swaggerjson": {"type": "string"}
  },
  "variables": {    
  },
    "resources": [
      {
        "type": "Microsoft.ApiManagement/service/apis",
        "name": "[concat(parameters('ApimServiceName'), '/animalAPI4')]",
        "apiVersion": "2018-02-01-preview",
        "scale": null,
        "properties": {
          "displayName": "HTTP animal API",
          "apiRevision": "1",
          "description": "API Management facade for a very handy and free online HTTP toolsds",
          "serviceUrl": "https://animailhttpbin.org",
          "path": "animals4",
          "contentFormat": "swagger-link-json",
          "contentValue": "[parameters('swaggerjson')]",
          "apiVersionSet": {
            "id": "[concat(resourceId('Microsoft.ApiManagement/service', parameters('ApimServiceName')), '/api-version-sets/versionset-animal-api4')]"
          },
          "protocols": [
            "https"
          ],
          "authenticationSettings": null,
          "subscriptionKeyParameterNames": null,
          "apiVersion": "v1"
        },
        "dependsOn": [
        ]
      }

    ]
}

1 个答案:

答案 0 :(得分:0)

弄清楚了问题所在是链接模板,从那里我在属性周围的方括号中还包含了DependOn。解决了括号问题