last sync: 2020-Sep-30 14:32:32 UTC

Azure Policy

Deploy SQL DB transparent data encryption

Policy DisplayName Deploy SQL DB transparent data encryption
Policy Id 86a912f6-9a06-4e26-b447-11b16ba8659f
Policy Category SQL
Policy Description Enables transparent data encryption on SQL databases
Policy Mode Indexed
Policy Type BuiltIn
Policy in Preview FALSE
Policy Deprecated FALSE
Policy Effect Fixed: DeployIfNotExists
Roles used
Role Name Role Id
SQL DB Contributor 9b7fa17d-e63e-47b0-bb0a-15c516ac86ec
Policy Changes no changes
Used in Policy Initiative(s) none
Policy Rule
{
  "properties": {
    "displayName": "Deploy SQL DB transparent data encryption",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "Enables transparent data encryption on SQL databases",
    "metadata": {
      "version": "1.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": {
            "field": "Microsoft.Sql/transparentDataEncryption.status",
            "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')]"
                }
              }
            }
          }
        }
      }
    }
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/86a912f6-9a06-4e26-b447-11b16ba8659f",
  "type": "Microsoft.Authorization/policyDefinitions",
  "name": "86a912f6-9a06-4e26-b447-11b16ba8659f"
}