如何使用Azure ARM模板自动安装New Relic扩展? [英] How do I automatically install New Relic extension using Azure ARM Template?

查看:102
本文介绍了如何使用Azure ARM模板自动安装New Relic扩展?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用azure手臂模板在azure中创建一个Web应用程序.现在,我需要在将使用此模板创建的webapp中安装New Relic Extension.所以我找不到特定的json格式.请帮帮我!

I am using a azure arm template to create a web app in azure. Now I need to install New Relic Extension in the webapps which will be created using this template. So I was unable to find specific json format. Please help me out!

推荐答案

请尝试添加添加到ARM模板中的json代码.

Please have a try to add the json code snipped in the ARM template.

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

我为此创建了一个演示.以下是我的详细步骤.有关扩展名,请参阅 NewRelic.Azure.WebSites .

I created a demo for it. The following is my detail steps. About the name of the extension please refer to the NewRelic.Azure.WebSites.

1.创建一个Azure资源组项目.

2.选择Web App项目模板

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'))]"
      }
    }
  ]
}

这篇关于如何使用Azure ARM模板自动安装New Relic扩展?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆