Bylaw

Gallery › Security Center › Azure built-in policies

[Deprecated]: Virtual machines should encrypt temp disks, caches, and data flows between Compute and Storage resources

Converted Policy AuditIfNotExists Disabled Mode All Version 2.1.0-deprecated Deprecated

This policy definition is no longer the recommended way to achieve its intent. Instead of continuing to use this policy, we recommend you assign this replacement policies with policy IDs 3dc5edcd-002d-444c-b216-e123bbfa37c0 and ca88aadc-6e2b-416c-9de2-5a0f01d1693f. Learn more about policy definition deprecation at aka.ms/policydefdeprecation

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

Azure Policy JSONASC_UnencryptedVMDisks_Audit.json · 57 lines
{
  "properties": {
    "displayName": "[Deprecated]: Virtual machines should encrypt temp disks, caches, and data flows between Compute and Storage resources",
    "policyType": "BuiltIn",
    "mode": "All",
    "description": "This policy definition is no longer the recommended way to achieve its intent. Instead of continuing to use this policy, we recommend you assign this replacement policies with policy IDs 3dc5edcd-002d-444c-b216-e123bbfa37c0 and ca88aadc-6e2b-416c-9de2-5a0f01d1693f. Learn more about policy definition deprecation at aka.ms/policydefdeprecation",
    "metadata": {
      "version": "2.1.0-deprecated",
      "category": "Security Center",
      "deprecated": true
    },
    "version": "2.1.0",
    "parameters": {
      "effect": {
        "type": "string",
        "defaultValue": "Disabled",
        "allowedValues": [
          "AuditIfNotExists",
          "Disabled"
        ],
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        }
      }
    },
    "policyRule": {
      "if": {
        "field": "type",
        "in": [
          "Microsoft.ClassicCompute/virtualMachines",
          "Microsoft.Compute/virtualMachines"
        ]
      },
      "then": {
        "effect": "[parameters('effect')]",
        "details": {
          "type": "Microsoft.Security/assessments",
          "name": "d57a4221-a804-52ca-3dea-768284f06bb7",
          "existenceCondition": {
            "field": "Microsoft.Security/assessments/status.code",
            "in": [
              "NotApplicable",
              "Healthy"
            ]
          }
        }
      }
    },
    "versions": [
      "2.1.0",
      "2.0.3"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/0961003e-5a0a-4549-abde-af6a37f2724d",
  "name": "0961003e-5a0a-4549-abde-af6a37f2724d"
}
Bylaw0961003e-5a0a-4549-abde-af6a37f2724d.bylaw.ps1 · 34 lines
# Converted from ASC_UnencryptedVMDisks_Audit.json by ConvertTo-Bylaw.
Policy '0961003e-5a0a-4549-abde-af6a37f2724d' {

    Properties @{
        DisplayName   = '[Deprecated]: Virtual machines should encrypt temp disks, caches, and data flows between Compute and Storage resources'
        Description   = 'This policy definition is no longer the recommended way to achieve its intent. Instead of continuing to use this policy, we recommend you assign this replacement policies with policy IDs 3dc5edcd-002d-444c-b216-e123bbfa37c0 and ca88aadc-6e2b-416c-9de2-5a0f01d1693f. Learn more about policy definition deprecation at aka.ms/policydefdeprecation'
        Version       = '2.1.0-deprecated'
        Category      = 'Security Center'
        Deprecated    = $true
        PolicyVersion = '2.1.0'
        Mode          = 'All'
    }

    Parameter Effect @{
        Type          = 'string'
        AllowedValues = @('AuditIfNotExists', 'Disabled')
        Default       = 'Disabled'
        DisplayName   = 'Effect'
        Description   = 'Enable or disable the execution of the policy'
    }

    Resource * {

        Require 'type is not one of 2 values' {
            Field type | Must -Not -BeIn @('Microsoft.ClassicCompute/virtualMachines', 'Microsoft.Compute/virtualMachines') -IfPresent
        }
    }

    AuditIfNotExists 'Microsoft.Security/assessments' -Name 'd57a4221-a804-52ca-3dea-768284f06bb7' -Effect (Param Effect) {
        Require 'status.code is one of 2 values' {
            Field status.code | Must -BeIn @('NotApplicable', 'Healthy')
        }
    }
}

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