Bylaw

Gallery › Search › Azure built-in policies

Configure Azure AI Search services to enforce customer-managed keys to encrypt data at rest

Converted Policy Deny Disabled Mode Indexed Version 1.0.1

Enabling encryption at rest using a customer-managed key on your Azure AI Search services provides additional control over the key used to encrypt data at rest. This feature is often applicable to customers with special compliance requirements to manage data encryption keys using a key vault.

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

Azure Policy JSONCMK_Deny.json · 50 lines
{
  "properties": {
    "displayName": "Configure Azure AI Search services to enforce customer-managed keys to encrypt data at rest",
    "description": "Enabling encryption at rest using a customer-managed key on your Azure AI Search services provides additional control over the key used to encrypt data at rest. This feature is often applicable to customers with special compliance requirements to manage data encryption keys using a key vault.",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "metadata": {
      "category": "Search",
      "version": "1.0.1"
    },
    "version": "1.0.1",
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        },
        "allowedValues": [
          "Deny",
          "Disabled"
        ],
        "defaultValue": "Deny"
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.Search/searchServices"
          },
          {
            "field": "Microsoft.Search/searchServices/encryptionWithCmk.enforcement",
            "notEquals": "Enabled"
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.0.1",
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/356da939-f20a-4bb9-86f8-5db445b0e354",
  "name": "356da939-f20a-4bb9-86f8-5db445b0e354"
}
Bylaw356da939-f20a-4bb9-86f8-5db445b0e354.bylaw.ps1 · 28 lines
# Converted from CMK_Deny.json by ConvertTo-Bylaw.
Policy '356da939-f20a-4bb9-86f8-5db445b0e354' {

    Properties @{
        DisplayName   = 'Configure Azure AI Search services to enforce customer-managed keys to encrypt data at rest'
        Description   = 'Enabling encryption at rest using a customer-managed key on your Azure AI Search services provides additional control over the key used to encrypt data at rest. This feature is often applicable to customers with special compliance requirements to manage data encryption keys using a key vault.'
        Category      = 'Search'
        Version       = '1.0.1'
        PolicyVersion = '1.0.1'
        Mode          = 'Indexed'
    }

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

    Resource 'Microsoft.Search/searchServices' {

        Require 'encryptionWithCmk.enforcement is Enabled' {
            Field encryptionWithCmk.enforcement | Must -Be 'Enabled'
        }
    }

    Effect (Param Effect)
}

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