Bylaw

Gallery › Security Center › Azure built-in policies

[Deprecated]: Log Analytics agent should be installed on your virtual machine scale sets for Azure Security Center monitoring

Converted Policy AuditIfNotExists Disabled Mode All Version 1.1.0-deprecated Deprecated

Security Center collects data from your Azure virtual machines (VMs) to monitor for security vulnerabilities and threats.

ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.

Azure Policy JSONASC_InstallLaAgentOnVmss.json · 56 lines
{
  "properties": {
    "displayName": "[Deprecated]: Log Analytics agent should be installed on your virtual machine scale sets for Azure Security Center monitoring",
    "policyType": "BuiltIn",
    "mode": "All",
    "description": "Security Center collects data from your Azure virtual machines (VMs) to monitor for security vulnerabilities and threats.",
    "metadata": {
      "version": "1.1.0-deprecated",
      "category": "Security Center",
      "deprecated": true
    },
    "version": "1.1.0",
    "parameters": {
      "effect": {
        "type": "string",
        "defaultValue": "Disabled",
        "allowedValues": [
          "AuditIfNotExists",
          "Disabled"
        ],
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        }
      }
    },
    "policyRule": {
      "if": {
        "field": "type",
        "in": [
          "Microsoft.Compute/virtualMachineScaleSets"
        ]
      },
      "then": {
        "effect": "[parameters('effect')]",
        "details": {
          "type": "Microsoft.Security/assessments",
          "name": "45cfe080-ceb1-a91e-9743-71551ed24e94",
          "existenceCondition": {
            "field": "Microsoft.Security/assessments/status.code",
            "in": [
              "NotApplicable",
              "Healthy"
            ]
          }
        }
      }
    },
    "versions": [
      "1.1.0",
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/a3a6ea0c-e018-4933-9ef0-5aaa1501449b",
  "name": "a3a6ea0c-e018-4933-9ef0-5aaa1501449b"
}
Bylawa3a6ea0c-e018-4933-9ef0-5aaa1501449b.bylaw.ps1 · 34 lines
# Converted from ASC_InstallLaAgentOnVmss.json by ConvertTo-Bylaw.
Policy 'a3a6ea0c-e018-4933-9ef0-5aaa1501449b' {

    Properties @{
        DisplayName   = '[Deprecated]: Log Analytics agent should be installed on your virtual machine scale sets for Azure Security Center monitoring'
        Description   = 'Security Center collects data from your Azure virtual machines (VMs) to monitor for security vulnerabilities and threats.'
        Version       = '1.1.0-deprecated'
        Category      = 'Security Center'
        Deprecated    = $true
        PolicyVersion = '1.1.0'
        Mode          = 'All'
    }

    Parameter Effect @{
        Type          = 'string'
        AllowedValues = @('AuditIfNotExists', 'Disabled')
        Default       = 'Disabled'
        DisplayName   = 'Effect'
        Description   = 'Enable or disable the execution of the policy'
    }

    Resource * {

        Require 'type is not one of 1 value' {
            Field type | Must -Not -BeIn @('Microsoft.Compute/virtualMachineScaleSets') -IfPresent
        }
    }

    AuditIfNotExists 'Microsoft.Security/assessments' -Name '45cfe080-ceb1-a91e-9743-71551ed24e94' -Effect (Param Effect) {
        Require 'status.code is one of 2 values' {
            Field status.code | Must -BeIn @('NotApplicable', 'Healthy')
        }
    }
}

Source: built-in-policies/policyDefinitions/Security Center/ASC_InstallLaAgentOnVmss.json in Azure/azure-policy, under the MIT licence.