Bylaw

Gallery › Security Center › Azure built-in policies

Log Analytics agent should be installed on your Cloud Services (extended support) role instances

Converted Policy AuditIfNotExists Disabled Mode Indexed Version 2.0.0

Security Center collects data from your Cloud Services (extended support) role instances 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_InstallLaAgentOnCSES.json · 52 lines
{
  "properties": {
    "displayName": "Log Analytics agent should be installed on your Cloud Services (extended support) role instances",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "Security Center collects data from your Cloud Services (extended support) role instances to monitor for security vulnerabilities and threats.",
    "metadata": {
      "version": "2.0.0",
      "category": "Security Center"
    },
    "version": "2.0.0",
    "parameters": {
      "effect": {
        "type": "string",
        "defaultValue": "AuditIfNotExists",
        "allowedValues": [
          "AuditIfNotExists",
          "Disabled"
        ],
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        }
      }
    },
    "policyRule": {
      "if": {
        "field": "type",
        "equals": "Microsoft.Compute/cloudServices"
      },
      "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": [
      "2.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/15fdbc87-8a47-4ee9-a2aa-9a2ea1f37554",
  "name": "15fdbc87-8a47-4ee9-a2aa-9a2ea1f37554"
}
Bylaw15fdbc87-8a47-4ee9-a2aa-9a2ea1f37554.bylaw.ps1 · 28 lines
# Converted from ASC_InstallLaAgentOnCSES.json by ConvertTo-Bylaw.
Policy '15fdbc87-8a47-4ee9-a2aa-9a2ea1f37554' {

    Properties @{
        DisplayName   = 'Log Analytics agent should be installed on your Cloud Services (extended support) role instances'
        Description   = 'Security Center collects data from your Cloud Services (extended support) role instances to monitor for security vulnerabilities and threats.'
        Version       = '2.0.0'
        Category      = 'Security Center'
        PolicyVersion = '2.0.0'
        Mode          = 'Indexed'
    }

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

    Resource 'Microsoft.Compute/cloudServices'

    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_InstallLaAgentOnCSES.json in Azure/azure-policy, under the MIT licence.