Bylaw

Gallery › Security Center › Azure built-in policies

[Deprecated]: Automatic provisioning of security monitoring agent

Converted Policy AuditIfNotExists Mode All Version 1.0.0-deprecated Deprecated

Installs security agent on VMs for advanced security alerts and preventions in Azure Security Center. Applies only for subscriptions that use Azure Security Center.

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

Azure Policy JSONASC_SecurityMonitoringAgent_Audit.json · 43 lines
{
  "properties": {
    "displayName": "[Deprecated]: Automatic provisioning of security monitoring agent",
    "policyType": "BuiltIn",
    "mode": "All",
    "description": "Installs security agent on VMs for advanced security alerts and preventions in Azure Security Center. Applies only for subscriptions that use Azure Security Center.",
    "metadata": {
      "version": "1.0.0-deprecated",
      "category": "Security Center",
      "deprecated": true
    },
    "version": "1.0.0",
    "parameters": {},
    "policyRule": {
      "if": {
        "field": "type",
        "in": [
          "Microsoft.Compute/virtualMachines",
          "Microsoft.ClassicCompute/virtualMachines"
        ]
      },
      "then": {
        "effect": "AuditIfNotExists",
        "details": {
          "type": "Microsoft.Security/complianceResults",
          "name": "securityAgent",
          "existenceCondition": {
            "field": "Microsoft.Security/complianceResults/resourceStatus",
            "in": [
              "OffByPolicy",
              "Healthy"
            ]
          }
        }
      }
    },
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/abcc6037-1fc4-47f6-aac5-89706589be24",
  "name": "abcc6037-1fc4-47f6-aac5-89706589be24"
}
Bylawabcc6037-1fc4-47f6-aac5-89706589be24.bylaw.ps1 · 26 lines
# Converted from ASC_SecurityMonitoringAgent_Audit.json by ConvertTo-Bylaw.
Policy 'abcc6037-1fc4-47f6-aac5-89706589be24' {

    Properties @{
        DisplayName   = '[Deprecated]: Automatic provisioning of security monitoring agent'
        Description   = 'Installs security agent on VMs for advanced security alerts and preventions in Azure Security Center. Applies only for subscriptions that use Azure Security Center.'
        Version       = '1.0.0-deprecated'
        Category      = 'Security Center'
        Deprecated    = $true
        PolicyVersion = '1.0.0'
        Mode          = 'All'
    }

    Resource * {

        Require 'type is not one of 2 values' {
            Field type | Must -Not -BeIn @('Microsoft.Compute/virtualMachines', 'Microsoft.ClassicCompute/virtualMachines') -IfPresent
        }
    }

    AuditIfNotExists 'Microsoft.Security/complianceResults' -Name 'securityAgent' {
        Require 'resourceStatus is one of 2 values' {
            Field resourceStatus | Must -BeIn @('OffByPolicy', 'Healthy')
        }
    }
}

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