【问题标题】:Update operations in Azure Api Managment with swagger link using ARM template使用 ARM 模板通过 swagger 链接更新 Azure Api 管理中的操作
【发布时间】:2019-04-07 17:20:43
【问题描述】:

我想使用 ARM 模板更新带有 swagger 链接的 API 操作。当我运行下面的 ARM 模板时,我得到了错误

"error": { "code": "InvalidRequestContent", "message": "请求 内容无效,无法反序列化:'找不到 “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": [
        ]
      }

    ]
}

【问题讨论】:

  • 为什么不直接删除dependsOn 属性?另外,根据错误,您在某处的属性下有dependOn
  • 我已经添加了dependsOn,看看它是否有任何不同,但发生了同样的错误。我添加了 Microsoft.ApiManagement/service/apis 的参考链接。因为在属性中没有dependsOn。

标签: azure azure-resource-manager


【解决方案1】:

发现问题出在链接模板上,我在该模板中调用了围绕属性的括号还包括dependsOn。修复了括号问题

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-01-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多