Bylaw

Gallery › Guest Configuration › Azure built-in policies

Linux machines should meet requirements for the Azure compute security baseline

Converted Policy AuditIfNotExists DeployIfNotExists Disabled Mode Indexed Version 3.0.0

Requires that prerequisites are deployed to the policy assignment scope. For details, visit https://aka.ms/gcpol. Machines are non-compliant if the machine is not configured correctly for one of the recommendations in the Azure compute security baseline.

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

Azure Policy JSONAzureLinuxBaseline_AINE.json · 558 lines
{
  "properties": {
    "displayName": "Linux machines should meet requirements for the Azure compute security baseline",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "Requires that prerequisites are deployed to the policy assignment scope. For details, visit https://aka.ms/gcpol. Machines are non-compliant if the machine is not configured correctly for one of the recommendations in the Azure compute security baseline.",
    "metadata": {
      "version": "3.0.0",
      "category": "Guest Configuration",
      "requiredProviders": [
        "Microsoft.GuestConfiguration"
      ],
      "guestConfiguration": {
        "name": "AzureLinuxBaseline",
        "version": "1.*",
        "configurationParameter": {
          "BaselineSettings": "AzureLinuxBaseline;BaselineSettings"
        }
      }
    },
    "version": "3.0.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"
        },
        "defaultValue": ""
      },
      "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*"
                          }
                        ]
                      },
                      {
                        "allOf": [
                          {
                            "field": "Microsoft.Compute/imagePublisher",
                            "equals": "RedHat"
                          },
                          {
                            "field": "Microsoft.Compute/imageSKU",
                            "notLike": "6*"
                          }
                        ]
                      },
                      {
                        "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*"
                          }
                        ]
                      },
                      {
                        "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": "AzureLinuxBaseline",
          "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": "AzureLinuxBaseline"
                },
                "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": "AzureLinuxBaseline;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": "AzureLinuxBaseline;BaselineSettings",
                            "value": "[parameters('BaselineSettings')]"
                          }
                        ]
                      }
                    }
                  }
                ]
              }
            }
          }
        }
      }
    },
    "versions": [
      "3.0.0",
      "2.5.0",
      "2.4.0",
      "2.3.1",
      "2.3.0",
      "2.2.0",
      "2.1.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/fc9b3da7-8347-4380-8e70-0a0361d8dedd",
  "name": "fc9b3da7-8347-4380-8e70-0a0361d8dedd"
}
Bylawfc9b3da7-8347-4380-8e70-0a0361d8dedd.bylaw.ps1 · 186 lines
# Converted from AzureLinuxBaseline_AINE.json by ConvertTo-Bylaw.
Policy 'fc9b3da7-8347-4380-8e70-0a0361d8dedd' {

    Properties @{
        DisplayName   = 'Linux machines should meet requirements for the Azure compute security baseline'
        Description   = 'Requires that prerequisites are deployed to the policy assignment scope. For details, visit https://aka.ms/gcpol. Machines are non-compliant if the machine is not configured correctly for one of the recommendations in the Azure compute security baseline.'
        Version       = '3.0.0'
        Category      = 'Guest Configuration'
        PolicyVersion = '3.0.0'
        Mode          = 'Indexed'
        Metadata      = [ordered]@{ requiredProviders = @('Microsoft.GuestConfiguration'); guestConfiguration = [ordered]@{ name = 'AzureLinuxBaseline'; version = '1.*'; configurationParameter = [ordered]@{ BaselineSettings = 'AzureLinuxBaseline;BaselineSettings' } } }
    }

    Parameter IncludeArcMachines @{
        Type          = 'string'
        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 @{
        Default     = ''
        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 @{
        Type          = 'string'
        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*'
                        }
                        AllOf {
                            Field 'Microsoft.Compute/imagePublisher' | Must -Be 'RedHat'
                            Field 'Microsoft.Compute/imageSKU' | Must -Not -BeLike '6*'
                        }
                        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*'
                        }
                        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 'AzureLinuxBaseline' -Effect (Param Effect) {
        Require 'complianceStatus is Compliant' {
            Field complianceStatus | Must -Be 'Compliant'
        }
        Deployment -TemplateFile './templates/fc9b3da7-8347-4380-8e70-0a0361d8dedd.json' -Parameters ([ordered]@{
                vmName            = (Arm '[field(''name'')]')
                location          = (Arm '[field(''location'')]')
                type              = (Arm '[field(''type'')]')
                tags              = (Arm '[field(''tags'')]')
                configurationName = 'AzureLinuxBaseline'
                BaselineSettings  = (Param BaselineSettings)
                InclusionLocation = (Param RemediationLocation)
            })
    }
}

Its deployment templates are written beside it:

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