Bylaw

Gallery › Storage › Azure built-in policies

[Deprecated]: [Deprecated]: Require blob encryption for storage accounts

Converted Policy Deny Mode Indexed Version 1.0.0-deprecated Deprecated

This policy ensures blob encryption for storage accounts is turned on. It only applies to Microsoft.Storage resource types, not other storage providers. This policy is deprecated because storage blob encryption is now enabled by default, and can no longer be disabled.

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

Azure Policy JSONStorageBlobEncryption_Deny.json · 37 lines
{
  "properties": {
    "displayName": "[Deprecated]: [Deprecated]: Require blob encryption for storage accounts",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "This policy ensures blob encryption for storage accounts is turned on. It only applies to Microsoft.Storage resource types, not other storage providers. This policy is deprecated because storage blob encryption is now enabled by default, and can no longer be disabled.",
    "metadata": {
      "version": "1.0.0-deprecated",
      "category": "Storage",
      "deprecated": true
    },
    "version": "1.0.0",
    "parameters": {},
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.Storage/storageAccounts"
          },
          {
            "field": "Microsoft.Storage/storageAccounts/enableBlobEncryption",
            "equals": "false"
          }
        ]
      },
      "then": {
        "effect": "deny"
      }
    },
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/7c5a74bf-ae94-4a74-8fcf-644d1e0e6e6f",
  "name": "7c5a74bf-ae94-4a74-8fcf-644d1e0e6e6f"
}
Bylaw7c5a74bf-ae94-4a74-8fcf-644d1e0e6e6f.bylaw.ps1 · 22 lines
# Converted from StorageBlobEncryption_Deny.json by ConvertTo-Bylaw.
Policy '7c5a74bf-ae94-4a74-8fcf-644d1e0e6e6f' {

    Properties @{
        DisplayName   = '[Deprecated]: [Deprecated]: Require blob encryption for storage accounts'
        Description   = 'This policy ensures blob encryption for storage accounts is turned on. It only applies to Microsoft.Storage resource types, not other storage providers. This policy is deprecated because storage blob encryption is now enabled by default, and can no longer be disabled.'
        Version       = '1.0.0-deprecated'
        Category      = 'Storage'
        Deprecated    = $true
        PolicyVersion = '1.0.0'
        Mode          = 'Indexed'
    }

    Resource 'Microsoft.Storage/storageAccounts' {

        Require 'enableBlobEncryption is not false' {
            Field enableBlobEncryption | Must -Not -Be 'false' -IfPresent
        }
    }

    Effect Deny
}

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