Bylaw

Gallery › Security Center › Azure built-in policies

[Preview]: ChangeTracking extension should be installed on your Windows Arc machine

Converted Policy AuditIfNotExists Disabled Mode Indexed Version 1.0.0-preview Preview

Install ChangeTracking Extension on Windows Arc machines to enable File Integrity Monitoring(FIM) in Azure Security Center. FIM examines operating system files, Windows registries, application software, Linux system files, and more, for changes that might indicate an attack. The extension can be installed in virtual machines and locations supported by Azure Monitoring Agent.

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

Azure Policy JSONASC_ChangeTrackingWindowsAgent_Arc_AINE.json · 135 lines
{
  "properties": {
    "displayName": "[Preview]: ChangeTracking extension should be installed on your Windows Arc machine",
    "description": "Install ChangeTracking Extension on Windows Arc machines to enable File Integrity Monitoring(FIM) in Azure Security Center. FIM examines operating system files, Windows registries, application software, Linux system files, and more, for changes that might indicate an attack. The extension can be installed in virtual machines and locations supported by Azure Monitoring Agent.",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "metadata": {
      "version": "1.0.0-preview",
      "category": "Security Center",
      "preview": true
    },
    "version": "1.0.0-preview",
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        },
        "defaultValue": "AuditIfNotExists",
        "allowedValues": [
          "AuditIfNotExists",
          "Disabled"
        ]
      },
      "listOfApplicableLocations": {
        "type": "Array",
        "metadata": {
          "displayName": "Applicable Locations",
          "description": "The list of locations where the policy should be applied.",
          "strongType": "location"
        },
        "allowedValues": [
          "australiasoutheast",
          "australiaeast",
          "brazilsouth",
          "canadacentral",
          "centralindia",
          "centralus",
          "eastasia",
          "eastus2euap",
          "eastus",
          "eastus2",
          "francecentral",
          "japaneast",
          "koreacentral",
          "northcentralus",
          "northeurope",
          "norwayeast",
          "southcentralus",
          "southeastasia",
          "switzerlandnorth",
          "uaenorth",
          "uksouth",
          "westcentralus",
          "westeurope",
          "westus",
          "westus2"
        ],
        "defaultValue": [
          "australiasoutheast",
          "australiaeast",
          "brazilsouth",
          "canadacentral",
          "centralindia",
          "centralus",
          "eastasia",
          "eastus2euap",
          "eastus",
          "eastus2",
          "francecentral",
          "japaneast",
          "koreacentral",
          "northcentralus",
          "northeurope",
          "norwayeast",
          "southcentralus",
          "southeastasia",
          "switzerlandnorth",
          "uaenorth",
          "uksouth",
          "westcentralus",
          "westeurope",
          "westus",
          "westus2"
        ]
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.HybridCompute/machines"
          },
          {
            "field": "location",
            "in": "[parameters('listOfApplicableLocations')]"
          },
          {
            "field": "Microsoft.HybridCompute/imageOffer",
            "like": "windows*"
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]",
        "details": {
          "type": "Microsoft.HybridCompute/machines/extensions",
          "existenceCondition": {
            "allOf": [
              {
                "field": "Microsoft.HybridCompute/machines/extensions/type",
                "equals": "ChangeTracking-Windows"
              },
              {
                "field": "Microsoft.HybridCompute/machines/extensions/Publisher",
                "equals": "Microsoft.Azure.ChangeTrackingAndInventory"
              },
              {
                "field": "Microsoft.HybridCompute/machines/extensions/provisioningState",
                "equals": "Succeeded"
              }
            ]
          }
        }
      }
    },
    "versions": [
      "1.0.0-PREVIEW"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/a7f5e735-d212-4c32-9229-d12bffbc7e00",
  "name": "a7f5e735-d212-4c32-9229-d12bffbc7e00"
}
Bylawa7f5e735-d212-4c32-9229-d12bffbc7e00.bylaw.ps1 · 47 lines
# Converted from ASC_ChangeTrackingWindowsAgent_Arc_AINE.json by ConvertTo-Bylaw.
Policy 'a7f5e735-d212-4c32-9229-d12bffbc7e00' {

    Properties @{
        DisplayName   = '[Preview]: ChangeTracking extension should be installed on your Windows Arc machine'
        Description   = 'Install ChangeTracking Extension on Windows Arc machines to enable File Integrity Monitoring(FIM) in Azure Security Center. FIM examines operating system files, Windows registries, application software, Linux system files, and more, for changes that might indicate an attack. The extension can be installed in virtual machines and locations supported by Azure Monitoring Agent.'
        Version       = '1.0.0-preview'
        Category      = 'Security Center'
        Preview       = $true
        PolicyVersion = '1.0.0-preview'
        Mode          = 'Indexed'
    }

    Parameter Effect @{
        AllowedValues = @('AuditIfNotExists', 'Disabled')
        Default       = 'AuditIfNotExists'
        DisplayName   = 'Effect'
        Description   = 'Enable or disable the execution of the policy'
    }
    Parameter ListOfApplicableLocations @{
        Type          = 'Array'
        AllowedValues = @('australiasoutheast', 'australiaeast', 'brazilsouth', 'canadacentral', 'centralindia', 'centralus', 'eastasia', 'eastus2euap', 'eastus', 'eastus2', 'francecentral', 'japaneast', 'koreacentral', 'northcentralus', 'northeurope', 'norwayeast', 'southcentralus', 'southeastasia', 'switzerlandnorth', 'uaenorth', 'uksouth', 'westcentralus', 'westeurope', 'westus', 'westus2')
        Default       = @('australiasoutheast', 'australiaeast', 'brazilsouth', 'canadacentral', 'centralindia', 'centralus', 'eastasia', 'eastus2euap', 'eastus', 'eastus2', 'francecentral', 'japaneast', 'koreacentral', 'northcentralus', 'northeurope', 'norwayeast', 'southcentralus', 'southeastasia', 'switzerlandnorth', 'uaenorth', 'uksouth', 'westcentralus', 'westeurope', 'westus', 'westus2')
        DisplayName   = 'Applicable Locations'
        Description   = 'The list of locations where the policy should be applied.'
        Metadata      = [ordered]@{ strongType = 'location' }
    }

    Resource 'Microsoft.HybridCompute/machines' {

        When {
            Field location | Must -BeIn (Param ListOfApplicableLocations)
        }

        Require 'imageOffer is not like windows*' {
            Field 'Microsoft.HybridCompute/imageOffer' | Must -Not -BeLike 'windows*' -IfPresent
        }
    }

    AuditIfNotExists 'Microsoft.HybridCompute/machines/extensions' -Effect (Param Effect) {
        Require 'type, publisher and provisioningState are as required' {
            Field 'Microsoft.HybridCompute/machines/extensions/type' | Must -Be 'ChangeTracking-Windows'
            Field publisher | Must -Be 'Microsoft.Azure.ChangeTrackingAndInventory'
            Field provisioningState | Must -Be 'Succeeded'
        }
    }
}

Source: built-in-policies/policyDefinitions/Security Center/ASC_ChangeTrackingWindowsAgent_Arc_AINE.json in Azure/azure-policy, under the MIT licence.