Bylaw

Gallery › Security Center › Azure Landing Zones Library

Configure periodic checking for missing system updates on azure virtual machines and Arc-enabled virtual machines

Converted Initiative Version 1.1.0

Configure auto-assessment (every 24 hours) for OS updates. You can control the scope of assignment according to machine subscription, resource group, location or tag. Learn more about this for Windows: https://aka.ms/computevm-windowspatchassessmentmode, for Linux: https://aka.ms/computevm-linuxpatchassessmentmode.

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

Azure Policy JSONDeploy-AUM-CheckUpdates.alz_policy_set_definition.json · 154 lines
{
  "name": "Deploy-AUM-CheckUpdates",
  "properties": {
    "description": "Configure auto-assessment (every 24 hours) for OS updates. You can control the scope of assignment according to machine subscription, resource group, location or tag. Learn more about this for Windows: https://aka.ms/computevm-windowspatchassessmentmode, for Linux: https://aka.ms/computevm-linuxpatchassessmentmode.",
    "displayName": "Configure periodic checking for missing system updates on azure virtual machines and Arc-enabled virtual machines",
    "metadata": {
      "alzCloudEnvironments": [
        "AzureCloud"
      ],
      "category": "Security Center",
      "source": "https://github.com/Azure/Enterprise-Scale/",
      "version": "1.1.0"
    },
    "parameters": {
      "assessmentMode": {
        "allowedValues": [
          "ImageDefault",
          "AutomaticByPlatform"
        ],
        "defaultValue": "AutomaticByPlatform",
        "metadata": {
          "description": "Assessment mode for the machines.",
          "displayName": "Assessment mode"
        },
        "type": "String"
      },
      "locations": {
        "defaultValue": [],
        "metadata": {
          "description": "The list of locations from which machines need to be targeted.",
          "displayName": "Machines locations",
          "strongType": "location"
        },
        "type": "Array"
      },
      "tagOperator": {
        "allowedValues": [
          "All",
          "Any"
        ],
        "defaultValue": "Any",
        "metadata": {
          "description": "Matching condition for resource tags",
          "displayName": "Tag operator"
        },
        "type": "String"
      },
      "tagValues": {
        "defaultValue": {},
        "metadata": {
          "description": "The list of tags that need to matched for getting target machines.",
          "displayName": "Tags on machines"
        },
        "type": "Object"
      }
    },
    "policyDefinitions": [
      {
        "definitionVersion": "4.*.*",
        "groupNames": [],
        "parameters": {
          "assessmentMode": {
            "value": "[parameters('assessmentMode')]"
          },
          "locations": {
            "value": "[parameters('locations')]"
          },
          "osType": {
            "value": "Windows"
          },
          "tagOperator": {
            "value": "[parameters('tagOperator')]"
          },
          "tagValues": {
            "value": "[parameters('tagValues')]"
          }
        },
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/59efceea-0c96-497e-a4a1-4eb2290dac15",
        "policyDefinitionReferenceId": "azureUpdateManagerVmCheckUpdateWindows"
      },
      {
        "definitionVersion": "4.*.*",
        "groupNames": [],
        "parameters": {
          "assessmentMode": {
            "value": "[parameters('assessmentMode')]"
          },
          "locations": {
            "value": "[parameters('locations')]"
          },
          "osType": {
            "value": "Linux"
          },
          "tagOperator": {
            "value": "[parameters('tagOperator')]"
          },
          "tagValues": {
            "value": "[parameters('tagValues')]"
          }
        },
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/59efceea-0c96-497e-a4a1-4eb2290dac15",
        "policyDefinitionReferenceId": "azureUpdateManagerVmCheckUpdateLinux"
      },
      {
        "definitionVersion": "2.*.*",
        "groupNames": [],
        "parameters": {
          "assessmentMode": {
            "value": "[parameters('assessmentMode')]"
          },
          "locations": {
            "value": "[parameters('locations')]"
          },
          "osType": {
            "value": "Windows"
          },
          "tagOperator": {
            "value": "[parameters('tagOperator')]"
          },
          "tagValues": {
            "value": "[parameters('tagValues')]"
          }
        },
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/bfea026e-043f-4ff4-9d1b-bf301ca7ff46",
        "policyDefinitionReferenceId": "azureUpdateManagerVmArcCheckUpdateWindows"
      },
      {
        "definitionVersion": "2.*.*",
        "groupNames": [],
        "parameters": {
          "assessmentMode": {
            "value": "[parameters('assessmentMode')]"
          },
          "locations": {
            "value": "[parameters('locations')]"
          },
          "osType": {
            "value": "Linux"
          },
          "tagOperator": {
            "value": "[parameters('tagOperator')]"
          },
          "tagValues": {
            "value": "[parameters('tagValues')]"
          }
        },
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/bfea026e-043f-4ff4-9d1b-bf301ca7ff46",
        "policyDefinitionReferenceId": "azureUpdateManagerVmArcCheckUpdateLinux"
      }
    ],
    "policyType": "Custom"
  },
  "type": "Microsoft.Authorization/policySetDefinitions"
}
BylawDeploy-AUM-CheckUpdates.bylaw.ps1 · 89 lines
# Converted from Deploy-AUM-CheckUpdates.alz_policy_set_definition.json by ConvertTo-Bylaw.
Initiative 'Deploy-AUM-CheckUpdates' {

    Properties @{
        DisplayName = 'Configure periodic checking for missing system updates on azure virtual machines and Arc-enabled virtual machines'
        Description = 'Configure auto-assessment (every 24 hours) for OS updates. You can control the scope of assignment according to machine subscription, resource group, location or tag. Learn more about this for Windows: https://aka.ms/computevm-windowspatchassessmentmode, for Linux: https://aka.ms/computevm-linuxpatchassessmentmode.'
        Category    = 'Security Center'
        Version     = '1.1.0'
        Metadata    = [ordered]@{ alzCloudEnvironments = @('AzureCloud'); source = 'https://github.com/Azure/Enterprise-Scale/' }
    }

    Parameter AssessmentMode @{
        AllowedValues = @('ImageDefault', 'AutomaticByPlatform')
        Default       = 'AutomaticByPlatform'
        DisplayName   = 'Assessment mode'
        Description   = 'Assessment mode for the machines.'
    }
    Parameter Locations @{
        Type        = 'Array'
        Default     = @()
        DisplayName = 'Machines locations'
        Description = 'The list of locations from which machines need to be targeted.'
        Metadata    = [ordered]@{ strongType = 'location' }
    }
    Parameter TagOperator @{
        AllowedValues = @('All', 'Any')
        Default       = 'Any'
        DisplayName   = 'Tag operator'
        Description   = 'Matching condition for resource tags'
    }
    Parameter TagValues @{
        Type        = 'Object'
        Default     = [ordered]@{  }
        DisplayName = 'Tags on machines'
        Description = 'The list of tags that need to matched for getting target machines.'
    }

    PolicyDefinition @{
        Id          = '59efceea-0c96-497e-a4a1-4eb2290dac15'
        ReferenceId = 'azureUpdateManagerVmCheckUpdateWindows'
        Version     = '4.*.*'
        Parameters  = [ordered]@{
            assessmentMode = (Param AssessmentMode)
            locations      = (Param Locations)
            osType         = 'Windows'
            tagOperator    = (Param TagOperator)
            tagValues      = (Param TagValues)
        }
    }

    PolicyDefinition @{
        Id          = '59efceea-0c96-497e-a4a1-4eb2290dac15'
        ReferenceId = 'azureUpdateManagerVmCheckUpdateLinux'
        Version     = '4.*.*'
        Parameters  = [ordered]@{
            assessmentMode = (Param AssessmentMode)
            locations      = (Param Locations)
            osType         = 'Linux'
            tagOperator    = (Param TagOperator)
            tagValues      = (Param TagValues)
        }
    }

    PolicyDefinition @{
        Id          = 'bfea026e-043f-4ff4-9d1b-bf301ca7ff46'
        ReferenceId = 'azureUpdateManagerVmArcCheckUpdateWindows'
        Version     = '2.*.*'
        Parameters  = [ordered]@{
            assessmentMode = (Param AssessmentMode)
            locations      = (Param Locations)
            osType         = 'Windows'
            tagOperator    = (Param TagOperator)
            tagValues      = (Param TagValues)
        }
    }

    PolicyDefinition @{
        Id          = 'bfea026e-043f-4ff4-9d1b-bf301ca7ff46'
        ReferenceId = 'azureUpdateManagerVmArcCheckUpdateLinux'
        Version     = '2.*.*'
        Parameters  = [ordered]@{
            assessmentMode = (Param AssessmentMode)
            locations      = (Param Locations)
            osType         = 'Linux'
            tagOperator    = (Param TagOperator)
            tagValues      = (Param TagValues)
        }
    }
}

Members (4)

Source: policy_set_definitions/Deploy-AUM-CheckUpdates.alz_policy_set_definition.json in Azure/Azure-Landing-Zones-Library, under the MIT licence.