Bylaw

Gallery › SQL › Azure Community Policy

Configure Azure SQL DB to use TLS 1.2

Doesn't convert yet Policy Audit Deny Disabled Modify Mode Indexed Version 1.0.0

Configure Azure SQL DB to use TLS 1.2

ConvertTo-Bylaw can't convert this policy yet:

Azure Policy JSONazurepolicy.json · 75 lines
{
  "name": "e7c2dace-6fe3-44e0-8f59-e4a9b100c311",
  "type": "Microsoft.Authorization/policyDefinitions",
  "properties": {
    "displayName": "Configure Azure SQL DB to use TLS 1.2",
    "description": "Configure Azure SQL DB to use TLS 1.2",
    "metadata": {
      "version": "1.0.0",
      "category": "SQL"
    },
    "mode": "Indexed",
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "Modify, Deny, Audit or Disabled the execution of the Policy"
        },
        "allowedValues": [
          "Modify",
          "Deny",
          "Audit",
          "Disabled"
        ],
        "defaultValue": "Modify"
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.Sql/servers"
          },
          {
            "anyOf": [
              {
                "field": "Microsoft.Sql/servers/minimalTlsVersion",
                "exists": false
              },
              {
                "field": "Microsoft.Sql/servers/minimalTlsVersion",
                "notequals": "1.2"
              },
              {
                "field": "Microsoft.Sql/servers/minimalTlsVersion",
                "equals": "1.0"
              },
              {
                "field": "Microsoft.Sql/servers/minimalTlsVersion",
                "equals": "1.1"
              }
            ]
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]",
        "details": {
          "roleDefinitionIds": [
            "/providers/microsoft.authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c"
          ],
          "conflictEffect": "audit",
          "operations": [
            {
              "operation": "addOrReplace",
              "field": "Microsoft.Sql/servers/minimalTlsVersion",
              "value": "1.2"
            }
          ]
        }
      }
    }
  }
}

Source: policyDefinitions/SQL/configure-azure-sql-db-to-use-tls-1.2/azurepolicy.json in Azure/Community-Policy, under the MIT licence.