Multiple extensions for a VM with Azure ARM

落爺英雄遲暮 提交于 2019-11-28 12:51:52

问题


We are configuring our VM with ARM. We use the DSC to install most of the requirements, however, installing the anti malware extension together with the DSC does not work.

We are getting the following error: Multiple VMExtensions per handler not supported for OS type 'Windows'. VMExtension 'dscExtension' with handler 'Microsoft.Powershell.DSC' already added or specified in input.

The resources look like this:

 {  
  "type":"Microsoft.Compute/virtualMachines/extensions",
  "name":"[concat(variables('vmName'),'/', 'antiMalwareExtension')]",
  "apiVersion":"[variables('api-version')]",
  "location":"[resourceGroup().location]",
  "dependsOn":[  
     "[concat('Microsoft.Compute/virtualMachines/', variables('vmName'))]"
  ],
  "properties":{  
     "publisher":"Microsoft.Azure.Security",
     "type":"IaaSAntimalware",
     "typeHandlerVersion":"1.1",
     "settings":{  
        "AntimalwareEnabled":"true",
        "Exclusions":{  
           "Paths":"C:\\Users",
           "Extensions":".txt",
           "Processes":"taskmgr.exe"
        },
        "RealtimeProtectionEnabled":"true",
        "ScheduledScanSettings":{  
           "isEnabled":"true",
           "scanType":"Quick",
           "day":"7",
           "time":"120"
        }
     },
     "protectedSettings":null
  }


},
{  
      "type":"Microsoft.Compute/virtualMachines/extensions",
      "name":"[concat(variables('vmName'),'/', 'dscExtension')]",
      "apiVersion":"[variables('api-version')]",
      "location":"[resourceGroup().location]",
      "dependsOn":[  
         "[concat('Microsoft.Compute/virtualMachines/', variables('vmName'))]"
      ],
      "properties":{  
         "publisher":"Microsoft.Powershell",
         "type":"DSC",
         "typeHandlerVersion":"2.9",
         "autoUpgradeMinorVersion":true,
         "settings":{  
            "ModulesUrl":"[parameters('dscLocation')]",
            "ConfigurationFunction":"[parameters('dscFunction')]",
            "Properties":{  
               "nodeName":"[variables('vmName')]"
            }
         }
      }

回答1:


When looking to your template the 2 extensions are executed at the same time. Add a dependsOn to one of them:

  "dependsOn":[  
     "[concat('Microsoft.Compute/virtualMachines/', variables('vmName'))]",
     "[concat('Microsoft.Compute/virtualMachines/', variables('vmName'),'/extensions/', 'antiMalwareExtension')]"
  ],


来源:https://stackoverflow.com/questions/45752453/multiple-extensions-for-a-vm-with-azure-arm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!