Bylaw

Gallery › Security Center › Azure built-in policies

[Deprecated]: System updates on virtual machine scale sets should be installed

Converted Policy AuditIfNotExists Disabled Mode Indexed Version 3.1.0-deprecated Deprecated

Audit whether there are any missing system security updates and critical updates that should be installed to ensure that your Windows and Linux virtual machine scale sets are secure.

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

Azure Policy JSONASC_VmssMissingSystemUpdates_Audit.json · 54 lines
{
  "properties": {
    "displayName": "[Deprecated]: System updates on virtual machine scale sets should be installed",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "Audit whether there are any missing system security updates and critical updates that should be installed to ensure that your Windows and Linux virtual machine scale sets are secure.",
    "metadata": {
      "version": "3.1.0-deprecated",
      "category": "Security Center",
      "deprecated": true
    },
    "version": "3.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",
        "equals": "Microsoft.Compute/virtualMachineScaleSets"
      },
      "then": {
        "effect": "[parameters('effect')]",
        "details": {
          "type": "Microsoft.Security/assessments",
          "name": "bd20bd91-aaf1-7f14-b6e4-866de2f43146",
          "existenceCondition": {
            "field": "Microsoft.Security/assessments/status.code",
            "in": [
              "NotApplicable",
              "Healthy"
            ]
          }
        }
      }
    },
    "versions": [
      "3.1.0",
      "3.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/c3f317a7-a95c-4547-b7e7-11017ebdf2fe",
  "name": "c3f317a7-a95c-4547-b7e7-11017ebdf2fe"
}
Bylawc3f317a7-a95c-4547-b7e7-11017ebdf2fe.bylaw.ps1 · 29 lines
# Converted from ASC_VmssMissingSystemUpdates_Audit.json by ConvertTo-Bylaw.
Policy 'c3f317a7-a95c-4547-b7e7-11017ebdf2fe' {

    Properties @{
        DisplayName   = '[Deprecated]: System updates on virtual machine scale sets should be installed'
        Description   = 'Audit whether there are any missing system security updates and critical updates that should be installed to ensure that your Windows and Linux virtual machine scale sets are secure.'
        Version       = '3.1.0-deprecated'
        Category      = 'Security Center'
        Deprecated    = $true
        PolicyVersion = '3.1.0'
        Mode          = 'Indexed'
    }

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

    Resource 'Microsoft.Compute/virtualMachineScaleSets'

    AuditIfNotExists 'Microsoft.Security/assessments' -Name 'bd20bd91-aaf1-7f14-b6e4-866de2f43146' -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_VmssMissingSystemUpdates_Audit.json in Azure/azure-policy, under the MIT licence.