【问题标题】:How do I automatically install New Relic extension using Azure ARM Template?如何使用 Azure ARM 模板自动安装 New Relic 扩展?
【发布时间】:2017-03-23 07:22:14
【问题描述】:

我正在使用 azure arm 模板在 azure 中创建 Web 应用程序。现在我需要在将使用此模板创建的 webapps 中安装 New Relic Extension。所以我找不到特定的 json 格式。请帮帮我!

【问题讨论】:

    标签: azure azure-web-app-service azure-automation azure-resource-manager


    【解决方案1】:

    请尝试添加 ARM 模板中截断的 json 代码。

     "resources": [
            {
              "apiVersion": "2015-08-01",
              "name": "NewRelic.Azure.WebSites",
              "type": "siteextensions",
              "dependsOn": [
                "[resourceId('Microsoft.Web/Sites', variables('webSiteName'))]"
              ],
              "properties": {
              }
            }
          ], 
    

    我为它创建了一个演示。以下是我的详细步骤。关于扩展名请参考NewRelic.Azure.WebSites

    1.创建 Azure 资源组项目。

    2。选择 Web 应用项目模板

    3。只是网站扩展的演示,所以我删除了不必要的资源

    4.在 ARM 模板中添加截断的代码

    5.通过 Visual Studio 部署网站

    6.在 Azure 门户中查看网站

    演示 ARM 模板:

    {
      "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
      "contentVersion": "1.0.0.0",
      "parameters": {
        "hostingPlanName": {
          "type": "string",
          "minLength": 1
        },
        "skuName": {
          "type": "string",
          "defaultValue": "F1",
          "allowedValues": [
            "F1",
            "D1",
            "B1",
            "B2",
            "B3",
            "S1",
            "S2",
            "S3",
            "P1",
            "P2",
            "P3",
            "P4"
          ],
          "metadata": {
            "description": "Describes plan's pricing tier and instance size. Check details at https://azure.microsoft.com/en-us/pricing/details/app-service/"
          }
        },
        "skuCapacity": {
          "type": "int",
          "defaultValue": 1,
          "minValue": 1,
          "metadata": {
            "description": "Describes plan's instance count"
          }
        }
      },
      "variables": {
        "webSiteName": "[concat('webSite', uniqueString(resourceGroup().id))]"
      },
      "resources": [
        {
          "apiVersion": "2015-08-01",
          "name": "[parameters('hostingPlanName')]",
          "type": "Microsoft.Web/serverfarms",
          "location": "[resourceGroup().location]",
          "tags": {
            "displayName": "HostingPlan"
          },
          "sku": {
            "name": "[parameters('skuName')]",
            "capacity": "[parameters('skuCapacity')]"
          },
          "properties": {
            "name": "[parameters('hostingPlanName')]"
          }
        },
        {
          "apiVersion": "2015-08-01",
          "name": "[variables('webSiteName')]",
          "type": "Microsoft.Web/sites",
          "location": "[resourceGroup().location]",
          "tags": {
            "[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]": "Resource",
            "displayName": "Website"
          },
          "dependsOn": [
            "[concat('Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]"
          ],
          "resources": [
            {
              "apiVersion": "2015-08-01",
              "name": "NewRelic.Azure.WebSites",
              "type": "siteextensions",
              "dependsOn": [
                "[resourceId('Microsoft.Web/Sites', variables('webSiteName'))]"
              ],
              "properties": {
              }
            }
          ],
          "properties": {
            "name": "[variables('webSiteName')]",
            "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('hostingPlanName'))]"
          }
        }
      ]
    }
    

    【讨论】:

    • 成功了,但是我们需要配置“属性”吗??
    【解决方案2】:
    "resources":[{
          "apiVersion": "2018-11-01",
          "name": "NewRelic.Azure.WebSites.Extension",
          "type": "siteextensions",
          "dependsOn": [
            "[resourceId('Microsoft.Web/sites', variables('appServiceName'))]"
          ]
        }]
    

    名称现在是 NewRelic.Azure.Websites.Extension。在这种情况下,您应该在变量 appServiceName 中提供您的应用服务名称。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-12-13
      相关资源
      最近更新 更多