Bylaw

Gallery › Guest Configuration › Azure built-in policies

[Preview]: Linux Workloads should comply with the Official STIG Technical Implementation Guides

Converted Policy AuditIfNotExists DeployIfNotExists Disabled Mode Indexed Version 1.2.0-preview Preview

This policy provides you the ability to customize and deploy STIG Guides for audit purposes to your Linux workloads across Azure, on-premises and hybrid environments. The contents of the STIG Guides are in parity with the benchmarks published at https://www.cyber.mil/stigs/. The policy is powered by kompli - https://github.com/microsoft/kompli. 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 JSONDISASTIGLinuxBaseline_AINE.json · 567 lines
{
  "properties": {
    "displayName": "[Preview]: Linux Workloads should comply with the Official STIG Technical Implementation Guides",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "This policy provides you the ability to customize and deploy STIG Guides for audit purposes to your Linux workloads across Azure, on-premises and hybrid environments. The contents of the STIG Guides  are in parity with the benchmarks published at https://www.cyber.mil/stigs/. The policy is powered by kompli - https://github.com/microsoft/kompli. Requires that prerequisites are deployed to the policy assignment scope. For details, visit https://aka.ms/gcpol.",
    "metadata": {
      "version": "1.2.0-preview",
      "category": "Guest Configuration",
      "requiredProviders": [
        "Microsoft.GuestConfiguration"
      ],
      "preview": true,
      "guestConfiguration": {
        "name": "STIGLinuxSecurityBaseline",
        "version": "1.*",
        "configurationParameter": {
          "BaselineSettings": "STIGLinuxSecurityBaseline;BaselineSettings"
        }
      }
    },
    "version": "1.2.0-preview",
    "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"
      },
      "RemediationLocations": {
        "type": "Array",
        "metadata": {
          "displayName": "Remediation Location",
          "strongType": "location",
          "description": "Locations in which deployed assignments use TargetedDeployAndAutoCorrect. Use '*' to include all locations. Leave empty to deploy Audit assignments only, including when running a remediation task.",
          "portalReview": "true"
        },
        "defaultValue": []
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "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": "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*"
                          },
                          {
                            "field": "Microsoft.Compute/imageSKU",
                            "notLike": "20*"
                          }
                        ]
                      },
                      {
                        "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": [
                  {
                    "field": "type",
                    "equals": "Microsoft.HybridCompute/machines"
                  },
                  {
                    "field": "Microsoft.HybridCompute/imageOffer",
                    "like": "linux*"
                  },
                  {
                    "value": "[parameters('IncludeArcMachines')]",
                    "equals": "true"
                  }
                ]
              }
            ]
          },
          {
            "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": "STIGLinuxSecurityBaseline",
          "existenceCondition": {
            "allOf": [
              {
                "field": "Microsoft.GuestConfiguration/guestConfigurationAssignments/complianceStatus",
                "equals": "Compliant"
              },
              {
                "value": "[parameters('BaselineSettings')]",
                "notEquals": "{}"
              }
            ]
          },
          "deployment": {
            "properties": {
              "mode": "incremental",
              "parameters": {
                "vmName": {
                  "value": "[field('name')]"
                },
                "location": {
                  "value": "[field('location')]"
                },
                "type": {
                  "value": "[field('type')]"
                },
                "tags": {
                  "value": "[field('tags')]"
                },
                "configurationName": {
                  "value": "STIGLinuxSecurityBaseline"
                },
                "BaselineSettings": {
                  "value": "[parameters('BaselineSettings')]"
                },
                "InclusionLocations": {
                  "value": "[parameters('RemediationLocations')]"
                }
              },
              "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"
                  },
                  "InclusionLocations": {
                    "type": "array",
                    "defaultValue": []
                  }
                },
                "variables": {
                  "locationFilterConfigured": "[not(empty(parameters('InclusionLocations')))]",
                  "locationMatches": "[if(variables('locationFilterConfigured'), or(contains(parameters('InclusionLocations'), '*'), contains(parameters('InclusionLocations'), 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('InclusionLocations')]"
                  }
                },
                "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": "STIGLinuxSecurityBaseline;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": "STIGLinuxSecurityBaseline;BaselineSettings",
                            "value": "[parameters('BaselineSettings')]"
                          }
                        ]
                      }
                    }
                  }
                ]
              }
            }
          }
        }
      }
    },
    "versions": [
      "1.2.0-PREVIEW",
      "1.1.0-PREVIEW",
      "1.0.0-PREVIEW"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/85b009e3-163c-4132-bba0-8b471c658587",
  "name": "85b009e3-163c-4132-bba0-8b471c658587"
}
Bylaw85b009e3-163c-4132-bba0-8b471c658587.bylaw.ps1 · 187 lines
# Converted from DISASTIGLinuxBaseline_AINE.json by ConvertTo-Bylaw.
Policy '85b009e3-163c-4132-bba0-8b471c658587' {

    Properties @{
        DisplayName   = '[Preview]: Linux Workloads should comply with the Official STIG Technical Implementation Guides'
        Description   = 'This policy provides you the ability to customize and deploy STIG Guides for audit purposes to your Linux workloads across Azure, on-premises and hybrid environments. The contents of the STIG Guides  are in parity with the benchmarks published at https://www.cyber.mil/stigs/. The policy is powered by kompli - https://github.com/microsoft/kompli. Requires that prerequisites are deployed to the policy assignment scope. For details, visit https://aka.ms/gcpol.'
        Version       = '1.2.0-preview'
        Category      = 'Guest Configuration'
        Preview       = $true
        PolicyVersion = '1.2.0-preview'
        Mode          = 'Indexed'
        Metadata      = [ordered]@{ requiredProviders = @('Microsoft.GuestConfiguration'); guestConfiguration = [ordered]@{ name = 'STIGLinuxSecurityBaseline'; version = '1.*'; configurationParameter = [ordered]@{ BaselineSettings = 'STIGLinuxSecurityBaseline;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 RemediationLocations @{
        Type        = 'Array'
        Default     = @()
        DisplayName = 'Remediation Location'
        Description = 'Locations in which deployed assignments use TargetedDeployAndAutoCorrect. Use ''*'' to include all locations. Leave empty to deploy Audit assignments only, including when running a remediation task.'
        JsonName    = 'RemediationLocations'
        Metadata    = [ordered]@{ strongType = 'location'; portalReview = 'true' }
    }

    Resource * {

        When {
            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 '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*'
                            Field 'Microsoft.Compute/imageSKU' | Must -Not -BeLike '20*'
                        }
                        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 {
                    Field type | Must -Be 'Microsoft.HybridCompute/machines'
                    Field 'Microsoft.HybridCompute/imageOffer' | Must -BeLike 'linux*'
                    Param IncludeArcMachines | Must -Be 'true'
                }
            }
            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 'STIGLinuxSecurityBaseline' -Effect (Param Effect) {
        Require 'complianceStatus is as required' {
            Field complianceStatus | Must -Be 'Compliant'
            Param BaselineSettings | Must -Not -Be '{}'
        }
        Deployment -TemplateFile './templates/85b009e3-163c-4132-bba0-8b471c658587.json' -Parameters ([ordered]@{
                vmName             = (Arm '[field(''name'')]')
                location           = (Arm '[field(''location'')]')
                type               = (Arm '[field(''type'')]')
                tags               = (Arm '[field(''tags'')]')
                configurationName  = 'STIGLinuxSecurityBaseline'
                BaselineSettings   = (Param BaselineSettings)
                InclusionLocations = (Param RemediationLocations)
            })
    }
}

Its deployment templates are written beside it:

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