【问题标题】:Install McAfee paid agent on existing Azure VMs using ARM templates使用 ARM 模板在现有 Azure VM 上安装 McAfee 付费代理
【发布时间】:2019-03-07 05:21:22
【问题描述】:

我正在寻找一种方法,通过使用“ARM 模板”添加带有 McAfee 付费代理的 VM 扩展来加入现有的 Azure windows VM。我无法找到正确的方法。

【问题讨论】:

    标签: json azure templates azure-resource-manager


    【解决方案1】:

    这里是添加带有 McAfee 试用版的 VM 的默认快速入门模板,您可以利用它进行进一步处理

    模板文件

    {
      "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
      "contentVersion": "1.0.0.0",
      "parameters": {
        "newStorageAccountName": {
          "type": "string",
          "metadata": {
            "description": "Storage Account Name"
          }
        },
        "publicIPAddressName": {
          "type": "string",
          "metadata": {
            "description": "Public IP Address Name"
          }
        },
        "publicIPAddressType": {
          "type": "string",
          "defaultValue": "Dynamic",
          "allowedValues": [
            "Dynamic"
          ],
          "metadata": {
            "description": "Public IP Address Type"
          }
        },
        "vmName": {
          "type": "string",
          "metadata": {
            "description": "Name of the VM"
          }
        },
        "vmSize": {
          "type": "string",
          "defaultValue": "Standard_D3",
          "metadata": {
            "description": "Size of the VM"
          }
        },
        "imagePublisher": {
          "type": "string",
          "defaultValue": "MicrosoftWindowsServer",
          "metadata": {
            "description": "Image Publisher"
          }
        },
        "imageOffer": {
          "type": "string",
          "defaultValue": "WindowsServer",
          "metadata": {
            "description": "Image Offer"
          }
        },
        "imageSKU": {
          "type": "string",
          "defaultValue": "2012-R2-Datacenter",
          "metadata": {
            "description": "Image SKU"
          }
        },
        "adminUsername": {
          "type": "string",
          "metadata": {
            "description": "Admin username"
          }
        },
        "adminPassword": {
          "type": "securestring",
          "metadata": {
            "description": "Admin password"
          }
        },
        "virtualNetworkName": {
          "type": "string",
          "metadata": {
            "description": "VNET Name"
          }
        },
        "addressPrefix": {
          "type": "string",
          "defaultValue": "10.0.0.0/16",
          "metadata": {
            "description": "VNET address space"
          }
        },
        "subnet1Name": {
          "type": "string",
          "defaultValue": "Subnet-1",
          "metadata": {
            "description": "Subnet 1 name"
          }
        },
        "subnet1Prefix": {
          "type": "string",
          "defaultValue": "10.0.0.0/24",
          "metadata": {
            "description": "Subnet 1 address space"
          }
        },
        "nicName": {
          "type": "string",
          "metadata": {
            "description": "Name of the NIC"
          }
        },
        "vmExtensionName": {
          "type": "string",
          "metadata": {
            "description": "Extension name"
          }
        },
        "location": {
          "type": "string",
          "defaultValue": "[resourceGroup().location]",
          "metadata": {
            "description": "Location for all resources."
          }
        }
      },
      "variables": {
        "vnetID": "[resourceId('Microsoft.Network/virtualNetworks',parameters('virtualNetworkName'))]",
        "subnet1Ref": "[concat(variables('vnetID'),'/subnets/',parameters('subnet1Name'))]",
        "storageAccountType": "Standard_LRS"
      },
      "resources": [
        {
          "type": "Microsoft.Storage/storageAccounts",
          "name": "[parameters('newStorageAccountName')]",
          "apiVersion": "2015-05-01-preview",
          "location": "[parameters('location')]",
          "properties": {
            "accountType": "[variables('storageAccountType')]"
          }
        },
        {
          "apiVersion": "2015-05-01-preview",
          "type": "Microsoft.Network/publicIPAddresses",
          "name": "[parameters('publicIPAddressName')]",
          "location": "[parameters('location')]",
          "properties": {
            "publicIPAllocationMethod": "[parameters('publicIPAddressType')]"
          }
        },
        {
          "apiVersion": "2015-05-01-preview",
          "type": "Microsoft.Network/virtualNetworks",
          "name": "[parameters('virtualNetworkName')]",
          "location": "[parameters('location')]",
          "properties": {
            "addressSpace": {
              "addressPrefixes": [
                "[parameters('addressPrefix')]"
              ]
            },
            "subnets": [
              {
                "name": "[parameters('subnet1Name')]",
                "properties": {
                  "addressPrefix": "[parameters('subnet1Prefix')]"
                }
              }
            ]
          }
        },
        {
          "apiVersion": "2015-05-01-preview",
          "type": "Microsoft.Network/networkInterfaces",
          "name": "[parameters('nicName')]",
          "location": "[parameters('location')]",
          "dependsOn": [
            "[concat('Microsoft.Network/publicIPAddresses/', parameters('publicIPAddressName'))]",
            "[concat('Microsoft.Network/virtualNetworks/', parameters('virtualNetworkName'))]"
          ],
          "properties": {
            "ipConfigurations": [
              {
                "name": "ipconfig1",
                "properties": {
                  "privateIPAllocationMethod": "Dynamic",
                  "publicIPAddress": {
                    "id": "[resourceId('Microsoft.Network/publicIPAddresses',parameters('publicIPAddressName'))]"
                  },
                  "subnet": {
                    "id": "[variables('subnet1Ref')]"
                  }
                }
              }
            ]
          }
        },
        {
          "apiVersion": "2017-03-30",
          "type": "Microsoft.Compute/virtualMachines",
          "name": "[parameters('vmName')]",
          "location": "[parameters('location')]",
          "dependsOn": [
            "[concat('Microsoft.Storage/storageAccounts/', parameters('newStorageAccountName'))]",
            "[concat('Microsoft.Network/networkInterfaces/', parameters('nicName'))]"
          ],
          "properties": {
            "hardwareProfile": {
              "vmSize": "[parameters('vmSize')]"
            },
            "osProfile": {
              "computerName": "[parameters('vmName')]",
              "adminUsername": "[parameters('adminUsername')]",
              "adminPassword": "[parameters('adminPassword')]"
            },
            "storageProfile": {
              "imageReference": {
                "publisher": "[parameters('imagePublisher')]",
                "offer": "[parameters('imageOffer')]",
                "sku": "[parameters('imageSKU')]",
                "version": "latest"
              },
              "osDisk": {
                "name": "[concat(parameters('vmName'),'_OSDisk')]", 
                "caching": "ReadWrite",
                "createOption": "FromImage"
              }
            },
            "networkProfile": {
              "networkInterfaces": [
                {
                  "id": "[resourceId('Microsoft.Network/networkInterfaces',parameters('nicName'))]"
                }
              ]
            }
          }
        },
        {
          "type": "Microsoft.Compute/virtualMachines/extensions",
          "name": "[concat(parameters('vmName'),'/', parameters('vmExtensionName'))]",
          "apiVersion": "2015-05-01-preview",
          "location": "[parameters('location')]",
          "dependsOn": [
            "[concat('Microsoft.Compute/virtualMachines/', parameters('vmName'))]"
          ],
          "properties": {
            "publisher": "McAfee.EndpointSecurity",
            "type": "McAfeeEndpointSecurity",
            "typeHandlerVersion": "6.0",
            "settings": {
              "featureVS": "true",
              "featureBP": "true",
              "featureFW": "true",
              "relayServer": "false"
            },
            "protectedSettings": null
          }
        }
      ]
    }

    您将能够在模板底部看到 VM 扩展节点。

    也请找到相同的参数列表。

    {
      "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
      "contentVersion": "1.0.0.0",
      "parameters": {
        "newStorageAccountName": {
          "value": "GEN-UNIQUE-8"
        },
        "publicIPAddressName": {
          "value": "GEN-UNIQUE-8"
        },
        "publicIPAddressType": {
          "value": "Dynamic"
        },
        "vmName": {
          "value": "GEN-UNIQUE-8"
        },
        "vmSize": {
          "value": "Standard_D3"
        },
        "adminUsername": {
          "value": "GEN-UNIQUE"
        },
        "adminPassword": {
          "value": "GEN-PASSWORD"
        },
        "virtualNetworkName": {
          "value": "GEN-VNET-NAME"
        },
        "nicName": {
          "value": "GEN-UNIQUE-8"
        },
        "vmExtensionName": {
          "value": "GEN-UNIQUE-8"
        }
      }
    }

    您可以从这里将其可视化:

    http://armviz.io/#/?load=https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2Fmcafee-extension-windows-vm%2Fazuredeploy.json

    希望对你有帮助。

    【讨论】:

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