Bylaw

Gallery › Storage › Azure built-in policies

Storage account encryption scopes should use double encryption for data at rest

Converted Policy Audit Deny Disabled Mode All Version 1.0.0

Enable infrastructure encryption for encryption at rest of your storage account encryption scopes for added security. Infrastructure encryption ensures that your data is encrypted twice.

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

Azure Policy JSONStorageEncryptionScopesShouldUseDoubleEncryption_Audit.json · 50 lines
{
  "properties": {
    "displayName": "Storage account encryption scopes should use double encryption for data at rest",
    "policyType": "BuiltIn",
    "mode": "All",
    "description": "Enable infrastructure encryption for encryption at rest of your storage account encryption scopes for added security. Infrastructure encryption ensures that your data is encrypted twice.",
    "metadata": {
      "version": "1.0.0",
      "category": "Storage"
    },
    "version": "1.0.0",
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the audit policy"
        },
        "allowedValues": [
          "Audit",
          "Deny",
          "Disabled"
        ],
        "defaultValue": "Audit"
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.Storage/storageAccounts/encryptionScopes"
          },
          {
            "field": "Microsoft.Storage/storageAccounts/encryptionScopes/requireInfrastructureEncryption",
            "notEquals": "true"
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/bfecdea6-31c4-4045-ad42-71b9dc87247d",
  "name": "bfecdea6-31c4-4045-ad42-71b9dc87247d"
}
Bylawbfecdea6-31c4-4045-ad42-71b9dc87247d.bylaw.ps1 · 28 lines
# Converted from StorageEncryptionScopesShouldUseDoubleEncryption_Audit.json by ConvertTo-Bylaw.
Policy 'bfecdea6-31c4-4045-ad42-71b9dc87247d' {

    Properties @{
        DisplayName   = 'Storage account encryption scopes should use double encryption for data at rest'
        Description   = 'Enable infrastructure encryption for encryption at rest of your storage account encryption scopes for added security. Infrastructure encryption ensures that your data is encrypted twice.'
        Version       = '1.0.0'
        Category      = 'Storage'
        PolicyVersion = '1.0.0'
        Mode          = 'All'
    }

    Parameter Effect @{
        AllowedValues = @('Audit', 'Deny', 'Disabled')
        Default       = 'Audit'
        DisplayName   = 'Effect'
        Description   = 'Enable or disable the execution of the audit policy'
    }

    Resource 'Microsoft.Storage/storageAccounts/encryptionScopes' {

        Require 'requireInfrastructureEncryption is true' {
            Field requireInfrastructureEncryption | Must -Be 'true'
        }
    }

    Effect (Param Effect)
}

Source: built-in-policies/policyDefinitions/Storage/StorageEncryptionScopesShouldUseDoubleEncryption_Audit.json in Azure/azure-policy, under the MIT licence.