Gallery › Network › Azure built-in policies
SQL Server should use a virtual network service endpoint
Converted Policy AuditIfNotExists Disabled Mode Indexed Version 1.0.0
This policy audits any SQL Server not configured to use a virtual network service endpoint.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONVirtualNetworkServiceEndpoint_SQLServer_AINE.json · 48 lines
{
"properties": {
"displayName": "SQL Server should use a virtual network service endpoint",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "This policy audits any SQL Server not configured to use a virtual network service endpoint.",
"metadata": {
"version": "1.0.0",
"category": "Network"
},
"version": "1.0.0",
"parameters": {
"effect": {
"type": "string",
"defaultValue": "AuditIfNotExists",
"allowedValues": [
"AuditIfNotExists",
"Disabled"
],
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
}
}
},
"policyRule": {
"if": {
"field": "type",
"equals": "Microsoft.Sql/servers"
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"type": "Microsoft.Sql/servers/virtualNetworkRules",
"existenceCondition": {
"field": "Microsoft.Sql/servers/virtualNetworkRules/virtualNetworkSubnetId",
"exists": "true"
}
}
}
},
"versions": [
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/ae5d2f14-d830-42b6-9899-df6cfe9c71a3",
"name": "ae5d2f14-d830-42b6-9899-df6cfe9c71a3"
}Bylawae5d2f14-d830-42b6-9899-df6cfe9c71a3.bylaw.ps1 · 28 lines
# Converted from VirtualNetworkServiceEndpoint_SQLServer_AINE.json by ConvertTo-Bylaw.
Policy 'ae5d2f14-d830-42b6-9899-df6cfe9c71a3' {
Properties @{
DisplayName = 'SQL Server should use a virtual network service endpoint'
Description = 'This policy audits any SQL Server not configured to use a virtual network service endpoint.'
Version = '1.0.0'
Category = 'Network'
PolicyVersion = '1.0.0'
Mode = 'Indexed'
}
Parameter Effect @{
Type = 'string'
AllowedValues = @('AuditIfNotExists', 'Disabled')
Default = 'AuditIfNotExists'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.Sql/servers'
AuditIfNotExists 'Microsoft.Sql/servers/virtualNetworkRules' -Effect (Param Effect) {
Require 'virtualNetworkSubnetId exists' {
Field virtualNetworkSubnetId | Must -Exist
}
}
}Source: built-in-policies/policyDefinitions/Network/VirtualNetworkServiceEndpoint_SQLServer_AINE.json in Azure/azure-policy, under the MIT licence.
Bylaw