Bylaw

Gallery › SQL Managed Instance › Azure built-in policies

TLS protocol 1.2 must be used for Arc SQL managed instances.

Converted Policy Audit Disabled Mode Indexed Version 1.0.0

As a part of network settings, Microsoft recommends allowing only TLS 1.2 for TLS protocols in SQL Servers. Learn more on network settings for SQL Server at https://aka.ms/TlsSettingsSQLServer.

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

Azure Policy JSONArc_SQLMI_TLS1.2IsUsed_Audit.json · 49 lines
{
  "properties": {
    "displayName": "TLS protocol 1.2 must be used for Arc SQL managed instances.",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "As a part of network settings, Microsoft recommends allowing only TLS 1.2 for TLS protocols in SQL Servers. Learn more on network settings for SQL Server at https://aka.ms/TlsSettingsSQLServer.",
    "metadata": {
      "version": "1.0.0",
      "category": "SQL Managed Instance"
    },
    "version": "1.0.0",
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        },
        "allowedValues": [
          "Audit",
          "Disabled"
        ],
        "defaultValue": "Audit"
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.AzureArcData/sqlmanagedinstances"
          },
          {
            "field": "Microsoft.AzureArcData/sqlManagedInstances/k8sRaw.spec.settings.network.tlsprotocols",
            "notContains": "1.2"
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/bb3c7464-033e-41ee-81dc-480fde675b20",
  "name": "bb3c7464-033e-41ee-81dc-480fde675b20"
}
Bylawbb3c7464-033e-41ee-81dc-480fde675b20.bylaw.ps1 · 28 lines
# Converted from Arc_SQLMI_TLS1.2IsUsed_Audit.json by ConvertTo-Bylaw.
Policy 'bb3c7464-033e-41ee-81dc-480fde675b20' {

    Properties @{
        DisplayName   = 'TLS protocol 1.2 must be used for Arc SQL managed instances.'
        Description   = 'As a part of network settings, Microsoft recommends allowing only TLS 1.2 for TLS protocols in SQL Servers. Learn more on network settings for SQL Server at https://aka.ms/TlsSettingsSQLServer.'
        Version       = '1.0.0'
        Category      = 'SQL Managed Instance'
        PolicyVersion = '1.0.0'
        Mode          = 'Indexed'
    }

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

    Resource 'Microsoft.AzureArcData/sqlmanagedinstances' {

        Require 'k8sRaw.spec.settings.network.tlsprotocols contains 1.2' {
            Field k8sRaw.spec.settings.network.tlsprotocols | Must -ContainText '1.2'
        }
    }

    Effect (Param Effect)
}

Source: built-in-policies/policyDefinitions/SQL Managed Instance/Arc_SQLMI_TLS1.2IsUsed_Audit.json in Azure/azure-policy, under the MIT licence.