首页 > 解决方案 > 如何在应用程序洞察资源之前部署 APIManagement Service Logger?

问题描述

我正在尝试使以下 ARM 部署 APIM 服务记录器,但是服务记录器在应用洞察资源之前开始部署并且失败,应用洞察资源位于单独的模板中。我添加了一个依赖声明,并认为可以完成这项工作,但那也不起作用。如果已经部署了应用洞察,下面的代码实际上也可以工作。

有人有任何指示吗?

{
      "type": "Microsoft.ApiManagement/service/loggers",
      "name": "[concat(variables('apiManagementInstanceName'), '/', parameters('appInsightsName'))]",
      "apiVersion": "2018-01-01",
      "properties": {
        "loggerType": "applicationInsights",
        "description": "Logger resources to APIM",
        "credentials": {
          "instrumentationKey": "[reference(resourceId('Microsoft.Insights/components', parameters('appInsightsName')), '2015-05-01').InstrumentationKey]"
        }
      }
     "dependsOn": [
        "[resourceId('microsoft.insights/components', parameters('appInsightsName'))]"
      ]

    }

还根据 APIM 和应用洞察力进行了尝试

"dependsOn": [
            //"[resourceId('Microsoft.ApiManagement/service', variables('apiManagementInstanceName'))]"
            "[resourceId('microsoft.insights/components', parameters('appInsightsName'))]"
          ],

标签: apiazure-resource-managerazure-api-management

解决方案


您可以使用链接模板来引用另一个模板文件并定义对它的依赖项:https ://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/linked-templates#linked-template


推荐阅读