last sync: 2021-Nov-26 17:15:01 UTC

Azure Policy definition

Deploy SQL DB transparent data encryption

Name Deploy SQL DB transparent data encryption
Azure Portal
Id 86a912f6-9a06-4e26-b447-11b16ba8659f
Version 2.0.0
details on versioning
Category SQL
Microsoft docs
Description Enables transparent data encryption on SQL databases
Mode Indexed
Type BuiltIn
Preview FALSE
Deprecated FALSE
Effect Fixed: DeployIfNotExists
Used RBAC Role
Role Name Role Id
SQL DB Contributor 9b7fa17d-e63e-47b0-bb0a-15c516ac86ec
History
Date/Time (UTC ymd) (i) Change type Change detail
2021-07-16 14:58:38 change Major (1.0.0 > 2.0.0)
Used in Initiatives none
JSON Changes

JSON
{
  "displayName": "Deploy SQL DB transparent data encryption",
  "policyType": "BuiltIn",
  "mode": "Indexed",
  "description": "Enables transparent data encryption on SQL databases",
  "metadata": {
    "version": "2.0.0",
    "category": "SQL"
  },
  "parameters": {},
  "policyRule": {
    "if": {
      "allOf": [
        {
          "field": "type",
          "equals": "Microsoft.Sql/servers/databases"
        },
        {
          "field": "name",
          "notEquals": "master"
        }
      ]
    },
    "then": {
      "effect": "DeployIfNotExists",
      "details": {
        "type": "Microsoft.Sql/servers/databases/transparentDataEncryption",
        "name": "current",
        "existenceCondition": {
          "anyOf": [
            {
              "field": "Microsoft.Sql/transparentDataEncryption.status",
              "equals": "enabled"
            },
            {
              "field": "Microsoft.Sql/servers/databases/transparentDataEncryption/state",
              "equals": "enabled"
            }
          ]
        },
        "roleDefinitionIds": [
          "/providers/microsoft.authorization/roleDefinitions/9b7fa17d-e63e-47b0-bb0a-15c516ac86ec"
        ],
        "deployment": {
          "properties": {
            "mode": "incremental",
            "template": {
              "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
              "contentVersion": "1.0.0.0",
              "parameters": {
                "fullDbName": {
                  "type": "string"
                }
              },
              "resources": [
                {
                  "name": "[concat(parameters('fullDbName'), '/current')]",
                  "type": "Microsoft.Sql/servers/databases/transparentDataEncryption",
                  "apiVersion": "2014-04-01",
                  "properties": {
                    "status": "Enabled"
                  }
                }
              ]
            },
            "parameters": {
              "fullDbName": {
                "value": "[field('fullName')]"
              }
            }
          }
        }
      }
    }
  }
}