Bylaw

Gallery › Security Center › Azure built-in policies

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

Converted Policy AuditIfNotExists Disabled Mode All Version 1.1.0-deprecated Deprecated

This policy audits any Windows/Linux virtual machines (VMs) if the Log Analytics agent is not installed which Security Center uses 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_InstallLaAgentOnVm.json · 57 lines
{
  "properties": {
    "displayName": "[Deprecated]: Log Analytics agent should be installed on your virtual machine for Azure Security Center monitoring",
    "policyType": "BuiltIn",
    "mode": "All",
    "description": "This policy audits any Windows/Linux virtual machines (VMs) if the Log Analytics agent is not installed which Security Center uses 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.ClassicCompute/virtualMachines",
          "Microsoft.Compute/virtualMachines"
        ]
      },
      "then": {
        "effect": "[parameters('effect')]",
        "details": {
          "type": "Microsoft.Security/assessments",
          "name": "d1db3318-01ff-16de-29eb-28b344515626",
          "existenceCondition": {
            "field": "Microsoft.Security/assessments/status.code",
            "in": [
              "NotApplicable",
              "Healthy"
            ]
          }
        }
      }
    },
    "versions": [
      "1.1.0",
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/a4fe33eb-e377-4efb-ab31-0784311bc499",
  "name": "a4fe33eb-e377-4efb-ab31-0784311bc499"
}
Bylawa4fe33eb-e377-4efb-ab31-0784311bc499.bylaw.ps1 · 34 lines
# Converted from ASC_InstallLaAgentOnVm.json by ConvertTo-Bylaw.
Policy 'a4fe33eb-e377-4efb-ab31-0784311bc499' {

    Properties @{
        DisplayName   = '[Deprecated]: Log Analytics agent should be installed on your virtual machine for Azure Security Center monitoring'
        Description   = 'This policy audits any Windows/Linux virtual machines (VMs) if the Log Analytics agent is not installed which Security Center uses 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 2 values' {
            Field type | Must -Not -BeIn @('Microsoft.ClassicCompute/virtualMachines', 'Microsoft.Compute/virtualMachines') -IfPresent
        }
    }

    AuditIfNotExists 'Microsoft.Security/assessments' -Name 'd1db3318-01ff-16de-29eb-28b344515626' -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_InstallLaAgentOnVm.json in Azure/azure-policy, under the MIT licence.