Gallery › SQL › Azure built-in policies
Azure SQL Managed Instances should disable public network access
Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0
Disabling public network access (public endpoint) on Azure SQL Managed Instances improves security by ensuring that they can only be accessed from inside their virtual networks or via Private Endpoints. To learn more about public network access, visit https://aka.ms/mi-public-endpoint.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONSqlManagedInstance_PublicEndpoint_Audit.json · 50 lines
{
"properties": {
"displayName": "Azure SQL Managed Instances should disable public network access",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Disabling public network access (public endpoint) on Azure SQL Managed Instances improves security by ensuring that they can only be accessed from inside their virtual networks or via Private Endpoints. To learn more about public network access, visit https://aka.ms/mi-public-endpoint.",
"metadata": {
"version": "1.0.0",
"category": "SQL"
},
"version": "1.0.0",
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
},
"allowedValues": [
"Audit",
"Deny",
"Disabled"
],
"defaultValue": "Audit"
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Sql/managedInstances"
},
{
"field": "Microsoft.Sql/managedInstances/publicDataEndpointEnabled",
"equals": true
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/9dfea752-dd46-4766-aed1-c355fa93fb91",
"name": "9dfea752-dd46-4766-aed1-c355fa93fb91"
}Bylaw9dfea752-dd46-4766-aed1-c355fa93fb91.bylaw.ps1 · 28 lines
# Converted from SqlManagedInstance_PublicEndpoint_Audit.json by ConvertTo-Bylaw.
Policy '9dfea752-dd46-4766-aed1-c355fa93fb91' {
Properties @{
DisplayName = 'Azure SQL Managed Instances should disable public network access'
Description = 'Disabling public network access (public endpoint) on Azure SQL Managed Instances improves security by ensuring that they can only be accessed from inside their virtual networks or via Private Endpoints. To learn more about public network access, visit https://aka.ms/mi-public-endpoint.'
Version = '1.0.0'
Category = 'SQL'
PolicyVersion = '1.0.0'
Mode = 'Indexed'
}
Parameter Effect @{
AllowedValues = @('Audit', 'Deny', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.Sql/managedInstances' {
Require 'publicDataEndpointEnabled is not true' {
Field publicDataEndpointEnabled | Must -Not -Be $true -IfPresent
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/SQL/SqlManagedInstance_PublicEndpoint_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw