Bylaw

Gallery › Guest Configuration › Azure built-in policies

Linux Workloads should comply with the Official CIS Security Benchmark

Converted Policy AuditIfNotExists DeployIfNotExists Disabled Mode Indexed Version 2.2.0

This policy provides you the ability to customize and deploy CIS Security Benchmarks for audit purposes to your Linux workloads across Azure, on-premises and hybrid environments. The contents of the CIS Security Benchmarks are in parity with the benchmarks published at https://cisecurity.org. The policy is powered by azure-osconfig. Requires that prerequisites are deployed to the policy assignment scope. For details, visit https://aka.ms/gcpol.

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

Azure Policy JSONCISLinuxBaseline_AINE.json · 575 lines
{
  "properties": {
    "displayName": "Linux Workloads should comply with the Official CIS Security Benchmark",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "This policy provides you the ability to customize and deploy CIS Security Benchmarks for audit purposes to your Linux workloads across Azure, on-premises and hybrid environments. The contents of the CIS Security Benchmarks are in parity with the benchmarks published at https://cisecurity.org. The policy is powered by azure-osconfig. Requires that prerequisites are deployed to the policy assignment scope. For details, visit https://aka.ms/gcpol.",
    "metadata": {
      "version": "2.2.0",
      "category": "Guest Configuration",
      "requiredProviders": [
        "Microsoft.GuestConfiguration"
      ],
      "guestConfiguration": {
        "name": "CISLinuxSecurityBaseline",
        "version": "1.*",
        "configurationParameter": {
          "BaselineSettings": "CISLinuxSecurityBaseline;BaselineSettings"
        }
      }
    },
    "version": "2.2.0",
    "parameters": {
      "IncludeArcMachines": {
        "type": "String",
        "metadata": {
          "displayName": "Include Arc connected servers",
          "description": "By selecting this option, you agree to be charged monthly per Arc connected machine.",
          "portalReview": "true"
        },
        "allowedValues": [
          "true",
          "false"
        ],
        "defaultValue": "false"
      },
      "ArcKind": {
        "type": "String",
        "metadata": {
          "displayName": "Arc machine cloud provider kind",
          "description": "Optional filter applied to every evaluated resource (Azure VM and Arc machine). Only resources whose 'kind' matches this value are evaluated. Use 'None' to disable this filter. Azure VMs do not have a 'kind' value, so setting this to AWS/GCP will exclude them from evaluation."
        },
        "allowedValues": [
          "AWS",
          "GCP",
          "None"
        ],
        "defaultValue": "None"
      },
      "tagFilter": {
        "type": "Object",
        "metadata": {
          "displayName": "Inclusion Tags",
          "description": "Optional inclusion tags filtering to limit which resources the policy applies to. Add any number of name/value pairs to the 'tags' array. Use AnyTags when any one tag can match, or AllTags when all specified tags must match. Leave 'tags' empty to apply the policy to all matching resources."
        },
        "defaultValue": {
          "mode": "AnyTags",
          "tags": []
        },
        "schema": {
          "type": "object",
          "properties": {
            "mode": {
              "type": "string",
              "enum": [
                "AnyTags",
                "AllTags"
              ]
            },
            "tags": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "value": {
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "value"
                ],
                "additionalProperties": false
              }
            }
          },
          "required": [
            "mode",
            "tags"
          ],
          "additionalProperties": false
        }
      },
      "BaselineSettings": {
        "type": "String",
        "metadata": {
          "description": "A customized Baseline Security JSON payload, for customizing security rules",
          "displayName": "Baseline Settings",
          "strongType": "MachineConfiguration/BaselineSettings",
          "portalReview": "true"
        }
      },
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of this policy",
          "portalReview": "true"
        },
        "allowedValues": [
          "DeployIfNotExists",
          "AuditIfNotExists",
          "Disabled"
        ],
        "defaultValue": "AuditIfNotExists"
      },
      "RemediationLocation": {
        "type": "Array",
        "metadata": {
          "displayName": "Remediation Location",
          "strongType": "location",
          "description": "Location to use for including devices in the scope for Remediation affects of this policy. If wildcard, all location are included in scope for DeployAndAutoCorrect, if empty, all devices will be Audited only, even after creating a Remediation Task.",
          "portalReview": "true"
        },
        "defaultValue": []
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "in": [
              "Microsoft.Compute/virtualMachines",
              "Microsoft.HybridCompute/machines"
            ]
          },
          {
            "anyOf": [
              {
                "allOf": [
                  {
                    "field": "type",
                    "equals": "Microsoft.Compute/virtualMachines"
                  },
                  {
                    "anyOf": [
                      {
                        "field": "Microsoft.Compute/imagePublisher",
                        "in": [
                          "microsoft-aks",
                          "qubole-inc",
                          "datastax",
                          "couchbase",
                          "scalegrid",
                          "checkpoint",
                          "paloaltonetworks",
                          "debian",
                          "credativ"
                        ]
                      },
                      {
                        "allOf": [
                          {
                            "field": "Microsoft.Compute/imagePublisher",
                            "equals": "OpenLogic"
                          },
                          {
                            "field": "Microsoft.Compute/imageSKU",
                            "notLike": "6*"
                          }
                        ]
                      },
                      {
                        "allOf": [
                          {
                            "field": "Microsoft.Compute/imagePublisher",
                            "equals": "Oracle"
                          },
                          {
                            "field": "Microsoft.Compute/imageSKU",
                            "notLike": "6*"
                          },
                          {
                            "field": "Microsoft.Compute/imageSKU",
                            "notLike": "7*"
                          }
                        ]
                      },
                      {
                        "allOf": [
                          {
                            "field": "Microsoft.Compute/imagePublisher",
                            "equals": "RedHat"
                          },
                          {
                            "field": "Microsoft.Compute/imageSKU",
                            "notLike": "6*"
                          },
                          {
                            "field": "Microsoft.Compute/imageSKU",
                            "notLike": "7*"
                          }
                        ]
                      },
                      {
                        "allOf": [
                          {
                            "field": "Microsoft.Compute/imagePublisher",
                            "equals": "center-for-internet-security-inc"
                          },
                          {
                            "field": "Microsoft.Compute/imageOffer",
                            "notLike": "cis-win*"
                          }
                        ]
                      },
                      {
                        "allOf": [
                          {
                            "field": "Microsoft.Compute/imagePublisher",
                            "equals": "Suse"
                          },
                          {
                            "field": "Microsoft.Compute/imageSKU",
                            "notLike": "11*"
                          }
                        ]
                      },
                      {
                        "allOf": [
                          {
                            "field": "Microsoft.Compute/imagePublisher",
                            "equals": "Canonical"
                          },
                          {
                            "field": "Microsoft.Compute/imageSKU",
                            "notLike": "12*"
                          },
                          {
                            "field": "Microsoft.Compute/imageSKU",
                            "notLike": "14*"
                          },
                          {
                            "field": "Microsoft.Compute/imageSKU",
                            "notLike": "16*"
                          },
                          {
                            "field": "Microsoft.Compute/imageSKU",
                            "notLike": "18*"
                          }
                        ]
                      },
                      {
                        "allOf": [
                          {
                            "field": "Microsoft.Compute/imagePublisher",
                            "equals": "microsoft-dsvm"
                          },
                          {
                            "field": "Microsoft.Compute/imageOffer",
                            "notLike": "dsvm-win*"
                          }
                        ]
                      },
                      {
                        "allOf": [
                          {
                            "field": "Microsoft.Compute/imagePublisher",
                            "equals": "cloudera"
                          },
                          {
                            "field": "Microsoft.Compute/imageSKU",
                            "notLike": "6*"
                          }
                        ]
                      },
                      {
                        "allOf": [
                          {
                            "field": "Microsoft.Compute/imagePublisher",
                            "equals": "microsoft-ads"
                          },
                          {
                            "field": "Microsoft.Compute/imageOffer",
                            "like": "linux*"
                          }
                        ]
                      },
                      {
                        "allOf": [
                          {
                            "anyOf": [
                              {
                                "field": "Microsoft.Compute/virtualMachines/osProfile.linuxConfiguration",
                                "exists": "true"
                              },
                              {
                                "field": "Microsoft.Compute/virtualMachines/storageProfile.osDisk.osType",
                                "like": "Linux*"
                              }
                            ]
                          },
                          {
                            "anyOf": [
                              {
                                "field": "Microsoft.Compute/imagePublisher",
                                "exists": "false"
                              },
                              {
                                "field": "Microsoft.Compute/imagePublisher",
                                "notIn": [
                                  "OpenLogic",
                                  "RedHat",
                                  "credativ",
                                  "Suse",
                                  "Canonical",
                                  "microsoft-dsvm",
                                  "cloudera",
                                  "microsoft-ads",
                                  "center-for-internet-security-inc",
                                  "Oracle",
                                  "AzureDatabricks",
                                  "azureopenshift"
                                ]
                              }
                            ]
                          }
                        ]
                      }
                    ]
                  }
                ]
              },
              {
                "allOf": [
                  {
                    "value": "[parameters('IncludeArcMachines')]",
                    "equals": "true"
                  },
                  {
                    "field": "type",
                    "equals": "Microsoft.HybridCompute/machines"
                  },
                  {
                    "field": "Microsoft.HybridCompute/imageOffer",
                    "like": "linux*"
                  }
                ]
              }
            ]
          },
          {
            "anyOf": [
              {
                "value": "[parameters('ArcKind')]",
                "equals": "None"
              },
              {
                "field": "kind",
                "equals": "[parameters('ArcKind')]"
              }
            ]
          },
          {
            "anyOf": [
              {
                "value": "[length(parameters('tagFilter').tags)]",
                "equals": 0
              },
              {
                "allOf": [
                  {
                    "value": "[parameters('tagFilter').mode]",
                    "equals": "AnyTags"
                  },
                  {
                    "count": {
                      "value": "[parameters('tagFilter').tags]",
                      "name": "tagItem",
                      "where": {
                        "value": "[if(contains(string(field('tags')), concat('\"', current('tagItem').name, '\":\"', current('tagItem').value, '\"')), equals(substring(string(field('tags')), add(indexOf(string(field('tags')), concat('\"', current('tagItem').name, '\":\"')), add(length(current('tagItem').name), 4)), length(current('tagItem').value)), current('tagItem').value), false())]",
                        "equals": true
                      }
                    },
                    "greater": 0
                  }
                ]
              },
              {
                "allOf": [
                  {
                    "value": "[parameters('tagFilter').mode]",
                    "equals": "AllTags"
                  },
                  {
                    "count": {
                      "value": "[parameters('tagFilter').tags]",
                      "name": "tagItem",
                      "where": {
                        "value": "[if(contains(string(field('tags')), concat('\"', current('tagItem').name, '\":\"', current('tagItem').value, '\"')), equals(substring(string(field('tags')), add(indexOf(string(field('tags')), concat('\"', current('tagItem').name, '\":\"')), add(length(current('tagItem').name), 4)), length(current('tagItem').value)), current('tagItem').value), false())]",
                        "equals": true
                      }
                    },
                    "equals": "[length(parameters('tagFilter').tags)]"
                  }
                ]
              }
            ]
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]",
        "details": {
          "roleDefinitionIds": [
            "/providers/microsoft.authorization/roleDefinitions/088ab73d-1256-47ae-bea9-9de8e7131f31"
          ],
          "type": "Microsoft.GuestConfiguration/guestConfigurationAssignments",
          "name": "CISLinuxSecurityBaseline",
          "existenceCondition": {
            "field": "Microsoft.GuestConfiguration/guestConfigurationAssignments/complianceStatus",
            "equals": "Compliant"
          },
          "deployment": {
            "properties": {
              "mode": "incremental",
              "parameters": {
                "vmName": {
                  "value": "[field('name')]"
                },
                "location": {
                  "value": "[field('location')]"
                },
                "type": {
                  "value": "[field('type')]"
                },
                "tags": {
                  "value": "[field('tags')]"
                },
                "configurationName": {
                  "value": "CISLinuxSecurityBaseline"
                },
                "BaselineSettings": {
                  "value": "[parameters('BaselineSettings')]"
                },
                "InclusionLocation": {
                  "value": "[parameters('RemediationLocation')]"
                }
              },
              "template": {
                "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
                "contentVersion": "1.0.0.0",
                "parameters": {
                  "vmName": {
                    "type": "string"
                  },
                  "location": {
                    "type": "string"
                  },
                  "type": {
                    "type": "string"
                  },
                  "tags": {
                    "type": "object",
                    "defaultValue": {}
                  },
                  "configurationName": {
                    "type": "string"
                  },
                  "BaselineSettings": {
                    "type": "string"
                  },
                  "InclusionLocation": {
                    "type": "array",
                    "defaultValue": []
                  }
                },
                "variables": {
                  "locationFilterConfigured": "[not(empty(parameters('InclusionLocation')))]",
                  "locationMatches": "[if(variables('locationFilterConfigured'), or(contains(parameters('InclusionLocation'), '*'), contains(parameters('InclusionLocation'), toLower(parameters('location')))), true())]",
                  "isIncluded": "[and(variables('locationFilterConfigured'), variables('locationMatches'))]",
                  "assignmentType": "[if(variables('isIncluded'), 'TargetedDeployAndAutoCorrect', 'Audit')]"
                },
                "outputs": {
                  "locationFilterConfigured": {
                    "type": "bool",
                    "value": "[variables('locationFilterConfigured')]"
                  },
                  "locationMatches": {
                    "type": "bool",
                    "value": "[variables('locationMatches')]"
                  },
                  "isIncluded": {
                    "type": "bool",
                    "value": "[variables('isIncluded')]"
                  },
                  "assignmentType": {
                    "type": "string",
                    "value": "[variables('assignmentType')]"
                  },
                  "resourceLocation": {
                    "type": "string",
                    "value": "[parameters('location')]"
                  },
                  "resourceTags": {
                    "type": "object",
                    "value": "[parameters('tags')]"
                  },
                  "configuredLocation": {
                    "type": "array",
                    "value": "[parameters('InclusionLocation')]"
                  }
                },
                "resources": [
                  {
                    "condition": "[equals(toLower(parameters('type')), toLower('microsoft.hybridcompute/machines'))]",
                    "apiVersion": "2018-11-20",
                    "type": "Microsoft.HybridCompute/machines/providers/guestConfigurationAssignments",
                    "name": "[concat(parameters('vmName'), '/Microsoft.GuestConfiguration/', parameters('configurationName'))]",
                    "location": "[parameters('location')]",
                    "properties": {
                      "guestConfiguration": {
                        "name": "[parameters('configurationName')]",
                        "version": "1.*",
                        "assignmentType": "[variables('assignmentType')]",
                        "configurationParameter": [
                          {
                            "name": "CISLinuxSecurityBaseline;BaselineSettings",
                            "value": "[parameters('BaselineSettings')]"
                          }
                        ]
                      }
                    }
                  },
                  {
                    "condition": "[equals(toLower(parameters('type')), toLower('Microsoft.Compute/virtualMachines'))]",
                    "apiVersion": "2018-11-20",
                    "type": "Microsoft.Compute/virtualMachines/providers/guestConfigurationAssignments",
                    "name": "[concat(parameters('vmName'), '/Microsoft.GuestConfiguration/', parameters('configurationName'))]",
                    "location": "[parameters('location')]",
                    "properties": {
                      "guestConfiguration": {
                        "name": "[parameters('configurationName')]",
                        "version": "1.*",
                        "assignmentType": "[variables('assignmentType')]",
                        "configurationParameter": [
                          {
                            "name": "CISLinuxSecurityBaseline;BaselineSettings",
                            "value": "[parameters('BaselineSettings')]"
                          }
                        ]
                      }
                    }
                  }
                ]
              }
            }
          }
        }
      }
    },
    "versions": [
      "2.2.0",
      "2.1.0",
      "2.0.0-PREVIEW",
      "1.0.1-PREVIEW",
      "1.0.0-PREVIEW"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/a3be3bae-0be0-4903-a924-edb7375c1d2e",
  "name": "a3be3bae-0be0-4903-a924-edb7375c1d2e"
}
Bylawa3be3bae-0be0-4903-a924-edb7375c1d2e.bylaw.ps1 · 189 lines
# Converted from CISLinuxBaseline_AINE.json by ConvertTo-Bylaw.
Policy 'a3be3bae-0be0-4903-a924-edb7375c1d2e' {

    Properties @{
        DisplayName   = 'Linux Workloads should comply with the Official CIS Security Benchmark'
        Description   = 'This policy provides you the ability to customize and deploy CIS Security Benchmarks for audit purposes to your Linux workloads across Azure, on-premises and hybrid environments. The contents of the CIS Security Benchmarks are in parity with the benchmarks published at https://cisecurity.org. The policy is powered by azure-osconfig. Requires that prerequisites are deployed to the policy assignment scope. For details, visit https://aka.ms/gcpol.'
        Version       = '2.2.0'
        Category      = 'Guest Configuration'
        PolicyVersion = '2.2.0'
        Mode          = 'Indexed'
        Metadata      = [ordered]@{ requiredProviders = @('Microsoft.GuestConfiguration'); guestConfiguration = [ordered]@{ name = 'CISLinuxSecurityBaseline'; version = '1.*'; configurationParameter = [ordered]@{ BaselineSettings = 'CISLinuxSecurityBaseline;BaselineSettings' } } }
    }

    Parameter IncludeArcMachines @{
        AllowedValues = @('true', 'false')
        Default       = 'false'
        DisplayName   = 'Include Arc connected servers'
        Description   = 'By selecting this option, you agree to be charged monthly per Arc connected machine.'
        JsonName      = 'IncludeArcMachines'
        Metadata      = [ordered]@{ portalReview = 'true' }
    }
    Parameter ArcKind @{
        AllowedValues = @('AWS', 'GCP', 'None')
        Default       = 'None'
        DisplayName   = 'Arc machine cloud provider kind'
        Description   = 'Optional filter applied to every evaluated resource (Azure VM and Arc machine). Only resources whose ''kind'' matches this value are evaluated. Use ''None'' to disable this filter. Azure VMs do not have a ''kind'' value, so setting this to AWS/GCP will exclude them from evaluation.'
        JsonName      = 'ArcKind'
    }
    Parameter TagFilter @{
        Type        = 'Object'
        Default     = [ordered]@{ mode = 'AnyTags'; tags = @() }
        DisplayName = 'Inclusion Tags'
        Description = 'Optional inclusion tags filtering to limit which resources the policy applies to. Add any number of name/value pairs to the ''tags'' array. Use AnyTags when any one tag can match, or AllTags when all specified tags must match. Leave ''tags'' empty to apply the policy to all matching resources.'
        Schema      = [ordered]@{
            type = 'object'
            properties = [ordered]@{
                mode = [ordered]@{ type = 'string'; enum = @('AnyTags', 'AllTags') }
                tags = [ordered]@{
                    type = 'array'
                    items = [ordered]@{
                        type = 'object'
                        properties = [ordered]@{
                            name = [ordered]@{ type = 'string' }
                            value = [ordered]@{ type = 'string' }
                        }
                        required = @('name', 'value')
                        additionalProperties = $false
                    }
                }
            }
            required = @('mode', 'tags')
            additionalProperties = $false
        }
    }
    Parameter BaselineSettings @{
        Type        = 'String'
        DisplayName = 'Baseline Settings'
        Description = 'A customized Baseline Security JSON payload, for customizing security rules'
        JsonName    = 'BaselineSettings'
        Metadata    = [ordered]@{ strongType = 'MachineConfiguration/BaselineSettings'; portalReview = 'true' }
    }
    Parameter Effect @{
        AllowedValues = @('DeployIfNotExists', 'AuditIfNotExists', 'Disabled')
        Default       = 'AuditIfNotExists'
        DisplayName   = 'Effect'
        Description   = 'Enable or disable the execution of this policy'
        Metadata      = [ordered]@{ portalReview = 'true' }
    }
    Parameter RemediationLocation @{
        Type        = 'Array'
        Default     = @()
        DisplayName = 'Remediation Location'
        Description = 'Location to use for including devices in the scope for Remediation affects of this policy. If wildcard, all location are included in scope for DeployAndAutoCorrect, if empty, all devices will be Audited only, even after creating a Remediation Task.'
        JsonName    = 'RemediationLocation'
        Metadata    = [ordered]@{ strongType = 'location'; portalReview = 'true' }
    }

    Resource * {

        When {
            Field type | Must -BeIn @('Microsoft.Compute/virtualMachines', 'Microsoft.HybridCompute/machines')
            AnyOf {
                AllOf {
                    Field type | Must -Be 'Microsoft.Compute/virtualMachines'
                    AnyOf {
                        Field 'Microsoft.Compute/imagePublisher' | Must -BeIn @('microsoft-aks', 'qubole-inc', 'datastax', 'couchbase', 'scalegrid', 'checkpoint', 'paloaltonetworks', 'debian', 'credativ')
                        AllOf {
                            Field 'Microsoft.Compute/imagePublisher' | Must -Be 'OpenLogic'
                            Field 'Microsoft.Compute/imageSKU' | Must -Not -BeLike '6*'
                        }
                        AllOf {
                            Field 'Microsoft.Compute/imagePublisher' | Must -Be 'Oracle'
                            Field 'Microsoft.Compute/imageSKU' | Must -Not -BeLike '6*'
                            Field 'Microsoft.Compute/imageSKU' | Must -Not -BeLike '7*'
                        }
                        AllOf {
                            Field 'Microsoft.Compute/imagePublisher' | Must -Be 'RedHat'
                            Field 'Microsoft.Compute/imageSKU' | Must -Not -BeLike '6*'
                            Field 'Microsoft.Compute/imageSKU' | Must -Not -BeLike '7*'
                        }
                        AllOf {
                            Field 'Microsoft.Compute/imagePublisher' | Must -Be 'center-for-internet-security-inc'
                            Field 'Microsoft.Compute/imageOffer' | Must -Not -BeLike 'cis-win*'
                        }
                        AllOf {
                            Field 'Microsoft.Compute/imagePublisher' | Must -Be 'Suse'
                            Field 'Microsoft.Compute/imageSKU' | Must -Not -BeLike '11*'
                        }
                        AllOf {
                            Field 'Microsoft.Compute/imagePublisher' | Must -Be 'Canonical'
                            Field 'Microsoft.Compute/imageSKU' | Must -Not -BeLike '12*'
                            Field 'Microsoft.Compute/imageSKU' | Must -Not -BeLike '14*'
                            Field 'Microsoft.Compute/imageSKU' | Must -Not -BeLike '16*'
                            Field 'Microsoft.Compute/imageSKU' | Must -Not -BeLike '18*'
                        }
                        AllOf {
                            Field 'Microsoft.Compute/imagePublisher' | Must -Be 'microsoft-dsvm'
                            Field 'Microsoft.Compute/imageOffer' | Must -Not -BeLike 'dsvm-win*'
                        }
                        AllOf {
                            Field 'Microsoft.Compute/imagePublisher' | Must -Be 'cloudera'
                            Field 'Microsoft.Compute/imageSKU' | Must -Not -BeLike '6*'
                        }
                        AllOf {
                            Field 'Microsoft.Compute/imagePublisher' | Must -Be 'microsoft-ads'
                            Field 'Microsoft.Compute/imageOffer' | Must -BeLike 'linux*'
                        }
                        AllOf {
                            AnyOf {
                                Field 'Microsoft.Compute/virtualMachines/osProfile.linuxConfiguration' | Must -Exist
                                Field 'Microsoft.Compute/virtualMachines/storageProfile.osDisk.osType' | Must -BeLike 'Linux*'
                            }
                            AnyOf {
                                Field 'Microsoft.Compute/imagePublisher' | Must -Not -Exist
                                Field 'Microsoft.Compute/imagePublisher' | Must -Not -BeIn @('OpenLogic', 'RedHat', 'credativ', 'Suse', 'Canonical', 'microsoft-dsvm', 'cloudera', 'microsoft-ads', 'center-for-internet-security-inc', 'Oracle', 'AzureDatabricks', 'azureopenshift')
                            }
                        }
                    }
                }
                AllOf {
                    Param IncludeArcMachines | Must -Be 'true'
                    Field type | Must -Be 'Microsoft.HybridCompute/machines'
                    Field 'Microsoft.HybridCompute/imageOffer' | Must -BeLike 'linux*'
                }
            }
            AnyOf {
                Param ArcKind | Must -Be 'None'
                Field kind | Must -Be (Param ArcKind)
            }
        }

        Require 'Requirement 1' {
            Arm '[length(parameters(''tagFilter'').tags)]' | Must -Not -Be 0
        }

        Require 'tags are as required' {
            AnyOf {
                Arm '[parameters(''tagFilter'').mode]' | Must -Not -Be 'AnyTags'
                Count -Value (Arm '[parameters(''tagFilter'').tags]') -Name tagItem -Where {
                    Arm '[if(contains(string(field(''tags'')), concat(''"'', current(''tagItem'').name, ''":"'', current(''tagItem'').value, ''"'')), equals(substring(string(field(''tags'')), add(indexOf(string(field(''tags'')), concat(''"'', current(''tagItem'').name, ''":"'')), add(length(current(''tagItem'').name), 4)), length(current(''tagItem'').value)), current(''tagItem'').value), false())]' | Must -Be $true
                } | Must -Be 0
            }
        }

        Require 'tags are as required' {
            AnyOf {
                Arm '[parameters(''tagFilter'').mode]' | Must -Not -Be 'AllTags'
                Count -Value (Arm '[parameters(''tagFilter'').tags]') -Name tagItem -Where {
                    Arm '[if(contains(string(field(''tags'')), concat(''"'', current(''tagItem'').name, ''":"'', current(''tagItem'').value, ''"'')), equals(substring(string(field(''tags'')), add(indexOf(string(field(''tags'')), concat(''"'', current(''tagItem'').name, ''":"'')), add(length(current(''tagItem'').name), 4)), length(current(''tagItem'').value)), current(''tagItem'').value), false())]' | Must -Be $true
                } | Must -Not -Be (Arm '[length(parameters(''tagFilter'').tags)]')
            }
        }
    }

    DeployIfNotExists 'Microsoft.GuestConfiguration/guestConfigurationAssignments' -Role 'Guest Configuration Resource Contributor' -Name 'CISLinuxSecurityBaseline' -Effect (Param Effect) {
        Require 'complianceStatus is Compliant' {
            Field complianceStatus | Must -Be 'Compliant'
        }
        Deployment -TemplateFile './templates/a3be3bae-0be0-4903-a924-edb7375c1d2e.json' -Parameters ([ordered]@{
                vmName            = (Arm '[field(''name'')]')
                location          = (Arm '[field(''location'')]')
                type              = (Arm '[field(''type'')]')
                tags              = (Arm '[field(''tags'')]')
                configurationName = 'CISLinuxSecurityBaseline'
                BaselineSettings  = (Param BaselineSettings)
                InclusionLocation = (Param RemediationLocation)
            })
    }
}

Its deployment templates are written beside it:

Source: built-in-policies/policyDefinitions/Guest Configuration/CISLinuxBaseline_AINE.json in Azure/azure-policy, under the MIT licence.