last sync: 2021-Oct-15 16:53:12 UTC

Azure Policy definition

[Preview]: Configure supported Linux virtual machine scale sets to automatically install the Azure Security agent

Name [Preview]: Configure supported Linux virtual machine scale sets to automatically install the Azure Security agent
Azure Portal
Id 6654c8c4-e6f8-43f8-8869-54327af7ce32
Version 1.0.0-preview
details on versioning
Category Security Center
Microsoft docs
Description Configure supported Linux virtual machine scale sets to automatically install the Azure Security agent. Security Center collects events from the agent and uses them to provide security alerts and tailored hardening tasks (recommendations). Target virtual machines must be in a supported location.
Mode Indexed
Type BuiltIn
Preview True
Deprecated FALSE
Effect Default: DeployIfNotExists
Allowed: (DeployIfNotExists, Disabled)
Used RBAC Role
Role Name Role Id
Virtual Machine Contributor 9980e02c-c2be-4d73-94e8-173b1dc7cf3c
History
Date/Time (UTC ymd) (i) Change type Change detail
2021-09-13 16:35:32 add 6654c8c4-e6f8-43f8-8869-54327af7ce32
Used in Initiatives none
JSON
{
  "displayName": "[Preview]: Configure supported Linux virtual machine scale sets to automatically install the Azure Security agent",
  "policyType": "BuiltIn",
  "mode": "Indexed",
  "description": "Configure supported Linux virtual machine scale sets to automatically install the Azure Security agent. Security Center collects events from the agent and uses them to provide security alerts and tailored hardening tasks (recommendations). Target virtual machines must be in a supported location.",
  "metadata": {
    "category": "Security Center",
    "version": "1.0.0-preview",
    "preview": true
  },
  "parameters": {
    "effect": {
      "type": "String",
      "metadata": {
        "displayName": "Effect",
        "description": "Enable or disable the execution of the policy"
      },
      "allowedValues": [
        "DeployIfNotExists",
        "Disabled"
      ],
      "defaultValue": "DeployIfNotExists"
    }
  },
  "policyRule": {
    "if": {
      "allOf": [
        {
          "field": "type",
          "equals": "Microsoft.Compute/virtualMachineScaleSets"
        },
        {
          "anyOf": [
            {
              "allOf": [
                {
                  "field": "Microsoft.Compute/imagePublisher",
                  "equals": "RedHat"
                },
                {
                  "field": "Microsoft.Compute/imageOffer",
                  "in": [
                    "RHEL",
                    "RHEL-SAP-HANA"
                  ]
                },
                {
                  "anyOf": [
                    {
                      "field": "Microsoft.Compute/imageSku",
                      "like": "6*"
                    },
                    {
                      "field": "Microsoft.Compute/imageSku",
                      "like": "7*"
                    },
                    {
                      "field": "Microsoft.Compute/imageSku",
                      "like": "8*"
                    }
                  ]
                }
              ]
            },
            {
              "allOf": [
                {
                  "field": "Microsoft.Compute/imagePublisher",
                  "equals": "SUSE"
                },
                {
                  "field": "Microsoft.Compute/imageOffer",
                  "in": [
                    "SLES",
                    "SLES-HPC",
                    "SLES-HPC-Priority",
                    "SLES-SAP",
                    "SLES-SAP-BYOS",
                    "SLES-Priority",
                    "SLES-BYOS",
                    "SLES-SAPCAL",
                    "SLES-Standard",
                    "SLES-12-SP5",
                    "SLES-15-SP2"
                  ]
                },
                {
                  "anyOf": [
                    {
                      "field": "Microsoft.Compute/imageSku",
                      "like": "12*"
                    },
                    {
                      "field": "Microsoft.Compute/imageSku",
                      "like": "15*"
                    },
                    {
                      "field": "Microsoft.Compute/imageSku",
                      "like": "gen*"
                    }
                  ]
                }
              ]
            },
            {
              "allOf": [
                {
                  "field": "Microsoft.Compute/imagePublisher",
                  "equals": "Canonical"
                },
                {
                  "field": "Microsoft.Compute/imageOffer",
                  "equals": "UbuntuServer"
                },
                {
                  "anyOf": [
                    {
                      "field": "Microsoft.Compute/imageSku",
                      "like": "14.04*LTS"
                    },
                    {
                      "field": "Microsoft.Compute/imageSku",
                      "like": "16.04*LTS"
                    },
                    {
                      "field": "Microsoft.Compute/imageSku",
                      "like": "18.04*LTS"
                    },
                    {
                      "field": "Microsoft.Compute/imageSku",
                      "like": "18_04-lts*"
                    }
                  ]
                }
              ]
            },
            {
              "allOf": [
                {
                  "field": "Microsoft.Compute/imagePublisher",
                  "equals": "Canonical"
                },
                {
                  "field": "Microsoft.Compute/imageOffer",
                  "equals": "0001-com-ubuntu-server-focal"
                },
                {
                  "field": "Microsoft.Compute/imageSku",
                  "like": "20_04-lts*"
                }
              ]
            },
            {
              "allOf": [
                {
                  "field": "Microsoft.Compute/imagePublisher",
                  "equals": "Oracle"
                },
                {
                  "field": "Microsoft.Compute/imageOffer",
                  "equals": "Oracle-Linux"
                },
                {
                  "anyOf": [
                    {
                      "field": "Microsoft.Compute/imageSku",
                      "like": "6.*"
                    },
                    {
                      "field": "Microsoft.Compute/imageSku",
                      "like": "7.*"
                    },
                    {
                      "field": "Microsoft.Compute/imageSku",
                      "like": "7*"
                    },
                    {
                      "field": "Microsoft.Compute/imageSku",
                      "like": "8*"
                    },
                    {
                      "field": "Microsoft.Compute/imageSku",
                      "equals": "ol83-lvm-gen2"
                    }
                  ]
                }
              ]
            },
            {
              "allOf": [
                {
                  "field": "Microsoft.Compute/imagePublisher",
                  "equals": "OpenLogic"
                },
                {
                  "field": "Microsoft.Compute/imageOffer",
                  "in": [
                    "CentOS",
                    "Centos-LVM",
                    "CentOS-SRIOV"
                  ]
                },
                {
                  "anyOf": [
                    {
                      "field": "Microsoft.Compute/imageSku",
                      "like": "6.*"
                    },
                    {
                      "field": "Microsoft.Compute/imageSku",
                      "like": "7*"
                    },
                    {
                      "field": "Microsoft.Compute/imageSku",
                      "like": "8*"
                    }
                  ]
                }
              ]
            },
            {
              "allOf": [
                {
                  "field": "Microsoft.Compute/imagePublisher",
                  "equals": "cloudera"
                },
                {
                  "field": "Microsoft.Compute/imageOffer",
                  "equals": "cloudera-centos-os"
                },
                {
                  "field": "Microsoft.Compute/imageSku",
                  "like": "7*"
                }
              ]
            },
            {
              "allOf": [
                {
                  "field": "Microsoft.Compute/imagePublisher",
                  "equals": "credativ"
                },
                {
                  "field": "Microsoft.Compute/imageOffer",
                  "in": [
                    "debian"
                  ]
                },
                {
                  "anyOf": [
                    {
                      "field": "Microsoft.Compute/imageSku",
                      "like": "8"
                    },
                    {
                      "field": "Microsoft.Compute/imageSku",
                      "like": "9"
                    }
                  ]
                }
              ]
            },
            {
              "allOf": [
                {
                  "field": "Microsoft.Compute/imagePublisher",
                  "equals": "Debian"
                },
                {
                  "field": "Microsoft.Compute/imageOffer",
                  "in": [
                    "debian-10"
                  ]
                },
                {
                  "field": "Microsoft.Compute/imageSku",
                  "like": "10"
                }
              ]
            }
          ]
        }
      ]
    },
    "then": {
      "effect": "[parameters('effect')]",
      "details": {
        "type": "Microsoft.Compute/virtualMachineScaleSets/extensions",
        "existenceCondition": {
          "allOf": [
            {
              "field": "Microsoft.Compute/virtualMachineScaleSets/extensions/type",
              "equals": "AzureSecurityLinuxAgent"
            },
            {
              "field": "Microsoft.Compute/virtualMachineScaleSets/extensions/publisher",
              "equals": "Microsoft.Azure.Security.Monitoring"
            },
            {
              "field": "Microsoft.Compute/virtualMachineScaleSets/extensions/provisioningState",
              "equals": "Succeeded"
            }
          ]
        },
        "roleDefinitionIds": [
          "/providers/microsoft.authorization/roleDefinitions/9980e02c-c2be-4d73-94e8-173b1dc7cf3c"
        ],
        "deployment": {
          "properties": {
            "mode": "incremental",
            "parameters": {
              "location": {
                "value": "[field('location')]"
              },
              "vmssName": {
                "value": "[field('name')]"
              }
            },
            "template": {
              "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
              "contentVersion": "1.0.0.0",
              "parameters": {
                "location": {
                  "type": "string"
                },
                "vmssName": {
                  "type": "string"
                }
              },
              "variables": {},
              "resources": [
                {
                  "type": "Microsoft.Compute/virtualMachineScaleSets/extensions",
                  "name": "[concat(parameters('vmssName'), '/', 'AzureSecurityLinuxAgent')]",
                  "apiVersion": "2019-03-01",
                  "location": "[parameters('location')]",
                  "properties": {
                    "publisher": "Microsoft.Azure.Security.Monitoring",
                    "type": "AzureSecurityLinuxAgent",
                    "typeHandlerVersion": "2.0",
                    "autoUpgradeMinorVersion": "true",
                    "settings": {},
                    "protectedSettings": {}
                  }
                }
              ]
            }
          }
        }
      }
    }
  }
}