Bylaw

Gallery › Mission › Azure built-in policies

Control the use of Azure SQL in Mission Platforms

Converted Initiative Version 1.0.0

This policy set applies exclusively to Mission Platform products and services; usage outside of these scopes is not supported. It deploys coordinated Azure SQL controls to enforce private networking, outbound restrictions, and customer-managed encryption for mission workloads (see https://learn.microsoft.com/azure/azure-sql/database/security-overview).

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

Azure Policy JSONSqlDBAndServerInitiative.json · 244 lines
{
  "properties": {
    "displayName": "Control the use of Azure SQL in Mission Platforms",
    "policyType": "BuiltIn",
    "description": "This policy set applies exclusively to Mission Platform products and services; usage outside of these scopes is not supported. It deploys coordinated Azure SQL controls to enforce private networking, outbound restrictions, and customer-managed encryption for mission workloads (see https://learn.microsoft.com/azure/azure-sql/database/security-overview).",
    "metadata": {
      "version": "1.0.0",
      "category": "Mission"
    },
    "version": "1.0.0",
    "parameters": {
      "sqlDatabaseRestrictNetAccessEffect": {
        "type": "String",
        "metadata": {
          "displayName": "SQL Database restrict network access",
          "description": "Enable or Disable the restriction of network access"
        },
        "allowedValues": [
          "Audit",
          "Deny",
          "Disabled"
        ],
        "defaultValue": "Audit"
      },
      "sqlServerEnableOutboundNetworkRestrictions": {
        "type": "String",
        "metadata": {
          "displayName": "SQL Server restrict outbound network",
          "description": "Enable or Disable the restriction of outbound network"
        },
        "allowedValues": [
          "Audit",
          "Deny",
          "Disabled"
        ],
        "defaultValue": "Audit"
      },
      "encryptSqlServerWithCmkEffect": {
        "type": "String",
        "metadata": {
          "displayName": "SQL server encrypt with Customer Managed Key (CMK)",
          "description": "Enable or Disable encryption with Customer Managed Key (CMK)"
        },
        "allowedValues": [
          "Audit",
          "Deny",
          "Disabled"
        ],
        "defaultValue": "Audit"
      },
      "restrictExternalPeSqlServerEffect": {
        "type": "String",
        "metadata": {
          "displayName": "SQL Server restrict external Private Endpoint",
          "description": "Deny external Private Endpoints to SQL Servers"
        },
        "allowedValues": [
          "Audit",
          "Deny",
          "Disabled"
        ],
        "defaultValue": "Audit"
      },
      "restrictExternalPeSqlServer_excludedSubIDs": {
        "type": "Array",
        "metadata": {
          "displayName": "SQL Server restrict external Private Endpoint on excluded subscriptions",
          "description": "Deny external Private Endpoints to SQL Servers  on excluded subscriptions"
        },
        "defaultValue": []
      }
    },
    "policyDefinitions": [
      {
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/ac01ad65-10e5-46df-bdd9-6b0cad13e1d2",
        "policyDefinitionReferenceId": "MSSqlManagedInstancesShouldUseCmkForEncryption",
        "definitionVersion": "2.*.*"
      },
      {
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/0a370ff3-6cab-4e85-8995-295fd854c5b8",
        "policyDefinitionReferenceId": "MSSqlServersShouldUseCmkForEncryption",
        "definitionVersion": "2.*.*"
      },
      {
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/a8793640-60f7-487c-b5c3-1d37215905c4",
        "policyDefinitionReferenceId": "MSSqlManagedInstancesShouldTls12orNewer",
        "definitionVersion": "1.*.*"
      },
      {
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/32e6bbec-16b6-44c2-be37-c5b672d103cf",
        "policyDefinitionReferenceId": "MSSqlServersShouldTls12orNewer",
        "definitionVersion": "2.*.*"
      },
      {
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/17k78e20-9358-41c9-923c-fb736d382a12",
        "policyDefinitionReferenceId": "MSSqlServersShouldHaveTransparentDataEncryptionEnabled",
        "definitionVersion": "2.*.*"
      },
      {
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/9dfea752-dd46-4766-aed1-c355fa93fb91",
        "policyDefinitionReferenceId": "MSSqlManagedInstancesShouldDisablePublicAccess",
        "definitionVersion": "1.*.*"
      },
      {
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/1b8ca024-1d5c-4dec-8995-b1a932b41780",
        "policyDefinitionReferenceId": "MSSqlServersShouldDisablePublicAccess",
        "definitionVersion": "1.*.*"
      },
      {
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/7698e800-9299-47a6-b3b6-5a0fee576eed",
        "policyDefinitionReferenceId": "MSSqlServersShouldUsePrivateLink",
        "definitionVersion": "1.*.*"
      },
      {
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/28b0b1e5-17ba-4963-a7a4-5a1ab4400a0b",
        "policyDefinitionReferenceId": "MSSqlServersDenyPublicAccess",
        "definitionVersion": "1.*.*"
      },
      {
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/86a912f6-9a06-4e26-b447-11b16ba8659f",
        "policyDefinitionReferenceId": "MSSqlServersTransparentDatabaseDataEncryption",
        "definitionVersion": "2.*.*"
      },
      {
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/ae5d2f14-d830-42b6-9899-df6cfe9c71a3",
        "policyDefinitionReferenceId": "MSSqlShouldUseServiceEndpoint",
        "definitionVersion": "1.*.*"
      },
      {
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/1f314764-cb73-4fc9-b863-8eca98ac36e9",
        "policyDefinitionReferenceId": "MSSqlAadAdminShouldBeProvisionedForSqlServers",
        "definitionVersion": "1.*.*"
      },
      {
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/abda6d70-9778-44e7-84a8-06713e6db027",
        "policyDefinitionReferenceId": "MSSqlShouldHaveAadOnlyAuthEnabled",
        "definitionVersion": "1.*.*"
      },
      {
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/78215662-041e-49ed-a9dd-5385911b3a1f",
        "policyDefinitionReferenceId": "MSSqlManagedInstancesShouldHaveAadOnlyAuthEnabled",
        "definitionVersion": "1.*.*"
      },
      {
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/a6fb4358-5bf4-4ad7-ba82-2cd2f41ce5e9",
        "policyDefinitionReferenceId": "MSSqlServersAuditingEnabled",
        "definitionVersion": "2.*.*",
        "parameters": {
          "setting": {
            "value": "enabled"
          }
        }
      },
      {
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/abfb4388-5bf4-4ad7-ba82-2cd2f41ceae9",
        "policyDefinitionReferenceId": "MSSqlServersDefenderEnabled",
        "definitionVersion": "2.*.*"
      },
      {
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/abfb7388-5bf4-4ad7-ba99-2cd2f41cebb9",
        "policyDefinitionReferenceId": "MSSqlManagedInstancesDefenderEnabled",
        "definitionVersion": "1.*.*"
      },
      {
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/c5a62eb0-c65a-4220-8a4d-f70dd4ca95dd",
        "policyDefinitionReferenceId": "MSSqlManagedInstancesDefenderConfigured",
        "definitionVersion": "2.*.*"
      },
      {
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/36d49e87-48c4-4f2e-beed-ba4ed02b71f5",
        "policyDefinitionReferenceId": "MSSqlServersDefenderConfigured",
        "definitionVersion": "2.*.*"
      },
      {
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/feedbf84-6b99-488c-acc2-71c829aa5ffc",
        "policyDefinitionReferenceId": "MSSqlDatabasesVulnerabilitiesResolved",
        "definitionVersion": "4.*.*"
      },
      {
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/89099bee-89e0-4b26-a5f4-165451757743",
        "policyDefinitionReferenceId": "MSSqlServersAuditingRetention",
        "definitionVersion": "3.*.*"
      },
      {
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/1b7aa243-30e4-4c9e-bca8-d0d3022b634a",
        "policyDefinitionReferenceId": "MSSqlManagedInstancesVulnerabilityAssessmentEnabled",
        "definitionVersion": "1.*.*"
      },
      {
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/ef2a8f2a-b3d9-49cd-a8a8-9a3aaaf647d9",
        "policyDefinitionReferenceId": "MSSqlServersVulnerabilityAssessmentEnabled",
        "definitionVersion": "3.*.*"
      },
      {
        "policyDefinitionReferenceId": "SqlDBDisablePublicNetwork",
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/5cc7aeef-357e-433d-9627-05354b40f8e2",
        "definitionVersion": "1.*.*",
        "parameters": {
          "effect": {
            "value": "[parameters('sqlDatabaseRestrictNetAccessEffect')]"
          }
        }
      },
      {
        "policyDefinitionReferenceId": "SqlEnableOutboundNetworkingRestrictions",
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/eae5dab1-5078-4686-a091-fce0e1e13d3b",
        "definitionVersion": "1.*.*",
        "parameters": {
          "effect": {
            "value": "[parameters('sqlServerEnableOutboundNetworkRestrictions')]"
          }
        }
      },
      {
        "policyDefinitionReferenceId": "SqlServerEncryptWithCMK",
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/5105a3c5-4ad7-44fd-be94-149ca62920b7",
        "definitionVersion": "1.*.*",
        "parameters": {
          "effect": {
            "value": "[parameters('encryptSqlServerWithCmkEffect')]"
          }
        }
      },
      {
        "policyDefinitionReferenceId": "SqlDenyExternalPrivateEndPointsToSQLServers",
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/b9ea0c2d-5c16-4d86-8e09-af82a239a0a4",
        "definitionVersion": "1.*.*",
        "parameters": {
          "effect": {
            "value": "[parameters('restrictExternalPeSqlServerEffect')]"
          },
          "excludedSubIDs": {
            "value": "[parameters('restrictExternalPeSqlServer_excludedSubIDs')]"
          }
        }
      }
    ],
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policySetDefinitions/d71f9441-4a54-41b0-ad12-5fe2ee8380ba",
  "name": "d71f9441-4a54-41b0-ad12-5fe2ee8380ba"
}
Bylawd71f9441-4a54-41b0-ad12-5fe2ee8380ba.bylaw.ps1 · 212 lines
# Converted from SqlDBAndServerInitiative.json by ConvertTo-Bylaw.
Initiative 'd71f9441-4a54-41b0-ad12-5fe2ee8380ba' {

    Properties @{
        DisplayName   = 'Control the use of Azure SQL in Mission Platforms'
        Description   = 'This policy set applies exclusively to Mission Platform products and services; usage outside of these scopes is not supported. It deploys coordinated Azure SQL controls to enforce private networking, outbound restrictions, and customer-managed encryption for mission workloads (see https://learn.microsoft.com/azure/azure-sql/database/security-overview).'
        Version       = '1.0.0'
        Category      = 'Mission'
        PolicyVersion = '1.0.0'
    }

    Parameter SqlDatabaseRestrictNetAccessEffect @{
        AllowedValues = @('Audit', 'Deny', 'Disabled')
        Default       = 'Audit'
        DisplayName   = 'SQL Database restrict network access'
        Description   = 'Enable or Disable the restriction of network access'
    }
    Parameter SqlServerEnableOutboundNetworkRestrictions @{
        AllowedValues = @('Audit', 'Deny', 'Disabled')
        Default       = 'Audit'
        DisplayName   = 'SQL Server restrict outbound network'
        Description   = 'Enable or Disable the restriction of outbound network'
    }
    Parameter EncryptSqlServerWithCmkEffect @{
        AllowedValues = @('Audit', 'Deny', 'Disabled')
        Default       = 'Audit'
        DisplayName   = 'SQL server encrypt with Customer Managed Key (CMK)'
        Description   = 'Enable or Disable encryption with Customer Managed Key (CMK)'
    }
    Parameter RestrictExternalPeSqlServerEffect @{
        AllowedValues = @('Audit', 'Deny', 'Disabled')
        Default       = 'Audit'
        DisplayName   = 'SQL Server restrict external Private Endpoint'
        Description   = 'Deny external Private Endpoints to SQL Servers'
    }
    Parameter RestrictExternalPeSqlServer_excludedSubIDs @{
        Type        = 'Array'
        Default     = @()
        DisplayName = 'SQL Server restrict external Private Endpoint on excluded subscriptions'
        Description = 'Deny external Private Endpoints to SQL Servers  on excluded subscriptions'
    }

    PolicyDefinition @{
        Id          = 'ac01ad65-10e5-46df-bdd9-6b0cad13e1d2'
        ReferenceId = 'MSSqlManagedInstancesShouldUseCmkForEncryption'
        Version     = '2.*.*'
    }

    PolicyDefinition @{
        Id          = '0a370ff3-6cab-4e85-8995-295fd854c5b8'
        ReferenceId = 'MSSqlServersShouldUseCmkForEncryption'
        Version     = '2.*.*'
    }

    PolicyDefinition @{
        Id          = 'a8793640-60f7-487c-b5c3-1d37215905c4'
        ReferenceId = 'MSSqlManagedInstancesShouldTls12orNewer'
        Version     = '1.*.*'
    }

    PolicyDefinition @{
        Id          = '32e6bbec-16b6-44c2-be37-c5b672d103cf'
        ReferenceId = 'MSSqlServersShouldTls12orNewer'
        Version     = '2.*.*'
    }

    PolicyDefinition @{
        Id          = '/providers/Microsoft.Authorization/policyDefinitions/17k78e20-9358-41c9-923c-fb736d382a12'
        ReferenceId = 'MSSqlServersShouldHaveTransparentDataEncryptionEnabled'
        Version     = '2.*.*'
    }

    PolicyDefinition @{
        Id          = '9dfea752-dd46-4766-aed1-c355fa93fb91'
        ReferenceId = 'MSSqlManagedInstancesShouldDisablePublicAccess'
        Version     = '1.*.*'
    }

    PolicyDefinition @{
        Id          = '1b8ca024-1d5c-4dec-8995-b1a932b41780'
        ReferenceId = 'MSSqlServersShouldDisablePublicAccess'
        Version     = '1.*.*'
    }

    PolicyDefinition @{
        Id          = '7698e800-9299-47a6-b3b6-5a0fee576eed'
        ReferenceId = 'MSSqlServersShouldUsePrivateLink'
        Version     = '1.*.*'
    }

    PolicyDefinition -Id '28b0b1e5-17ba-4963-a7a4-5a1ab4400a0b' -ReferenceId 'MSSqlServersDenyPublicAccess' -Version '1.*.*'

    PolicyDefinition @{
        Id          = '86a912f6-9a06-4e26-b447-11b16ba8659f'
        ReferenceId = 'MSSqlServersTransparentDatabaseDataEncryption'
        Version     = '2.*.*'
    }

    PolicyDefinition @{
        Id          = 'ae5d2f14-d830-42b6-9899-df6cfe9c71a3'
        ReferenceId = 'MSSqlShouldUseServiceEndpoint'
        Version     = '1.*.*'
    }

    PolicyDefinition @{
        Id          = '1f314764-cb73-4fc9-b863-8eca98ac36e9'
        ReferenceId = 'MSSqlAadAdminShouldBeProvisionedForSqlServers'
        Version     = '1.*.*'
    }

    PolicyDefinition @{
        Id          = 'abda6d70-9778-44e7-84a8-06713e6db027'
        ReferenceId = 'MSSqlShouldHaveAadOnlyAuthEnabled'
        Version     = '1.*.*'
    }

    PolicyDefinition @{
        Id          = '78215662-041e-49ed-a9dd-5385911b3a1f'
        ReferenceId = 'MSSqlManagedInstancesShouldHaveAadOnlyAuthEnabled'
        Version     = '1.*.*'
    }

    PolicyDefinition @{
        Id          = 'a6fb4358-5bf4-4ad7-ba82-2cd2f41ce5e9'
        ReferenceId = 'MSSqlServersAuditingEnabled'
        Version     = '2.*.*'
        Parameters  = @{
            setting = 'enabled'
        }
    }

    PolicyDefinition -Id 'abfb4388-5bf4-4ad7-ba82-2cd2f41ceae9' -ReferenceId 'MSSqlServersDefenderEnabled' -Version '2.*.*'

    PolicyDefinition @{
        Id          = 'abfb7388-5bf4-4ad7-ba99-2cd2f41cebb9'
        ReferenceId = 'MSSqlManagedInstancesDefenderEnabled'
        Version     = '1.*.*'
    }

    PolicyDefinition @{
        Id          = 'c5a62eb0-c65a-4220-8a4d-f70dd4ca95dd'
        ReferenceId = 'MSSqlManagedInstancesDefenderConfigured'
        Version     = '2.*.*'
    }

    PolicyDefinition @{
        Id          = '36d49e87-48c4-4f2e-beed-ba4ed02b71f5'
        ReferenceId = 'MSSqlServersDefenderConfigured'
        Version     = '2.*.*'
    }

    PolicyDefinition @{
        Id          = 'feedbf84-6b99-488c-acc2-71c829aa5ffc'
        ReferenceId = 'MSSqlDatabasesVulnerabilitiesResolved'
        Version     = '4.*.*'
    }

    PolicyDefinition @{
        Id          = '89099bee-89e0-4b26-a5f4-165451757743'
        ReferenceId = 'MSSqlServersAuditingRetention'
        Version     = '3.*.*'
    }

    PolicyDefinition @{
        Id          = '1b7aa243-30e4-4c9e-bca8-d0d3022b634a'
        ReferenceId = 'MSSqlManagedInstancesVulnerabilityAssessmentEnabled'
        Version     = '1.*.*'
    }

    PolicyDefinition @{
        Id          = 'ef2a8f2a-b3d9-49cd-a8a8-9a3aaaf647d9'
        ReferenceId = 'MSSqlServersVulnerabilityAssessmentEnabled'
        Version     = '3.*.*'
    }

    PolicyDefinition @{
        Id          = '5cc7aeef-357e-433d-9627-05354b40f8e2'
        ReferenceId = 'SqlDBDisablePublicNetwork'
        Version     = '1.*.*'
        Parameters  = @{
            effect = (Param SqlDatabaseRestrictNetAccessEffect)
        }
    }

    PolicyDefinition @{
        Id          = 'eae5dab1-5078-4686-a091-fce0e1e13d3b'
        ReferenceId = 'SqlEnableOutboundNetworkingRestrictions'
        Version     = '1.*.*'
        Parameters  = @{
            effect = (Param SqlServerEnableOutboundNetworkRestrictions)
        }
    }

    PolicyDefinition @{
        Id          = '5105a3c5-4ad7-44fd-be94-149ca62920b7'
        ReferenceId = 'SqlServerEncryptWithCMK'
        Version     = '1.*.*'
        Parameters  = @{
            effect = (Param EncryptSqlServerWithCmkEffect)
        }
    }

    PolicyDefinition @{
        Id          = 'b9ea0c2d-5c16-4d86-8e09-af82a239a0a4'
        ReferenceId = 'SqlDenyExternalPrivateEndPointsToSQLServers'
        Version     = '1.*.*'
        Parameters  = [ordered]@{
            effect         = (Param RestrictExternalPeSqlServerEffect)
            excludedSubIDs = (Param RestrictExternalPeSqlServer_excludedSubIDs)
        }
    }
}

Members (27)

Source: built-in-policies/policySetDefinitions/Mission/SqlDBAndServerInitiative.json in Azure/azure-policy, under the MIT licence.