Gallery › SQL › Azure built-in policies
MariaDB server should use a virtual network service endpoint
Converted Policy AuditIfNotExists Disabled Mode Indexed Version 1.0.2
Virtual network based firewall rules are used to enable traffic from a specific subnet to Azure Database for MariaDB while ensuring the traffic stays within the Azure boundary. This policy provides a way to audit if the Azure Database for MariaDB has virtual network service endpoint being used.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONMariaDB_VirtualNetworkServiceEndpoint_Audit.json · 48 lines
{
"properties": {
"displayName": "MariaDB server should use a virtual network service endpoint",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Virtual network based firewall rules are used to enable traffic from a specific subnet to Azure Database for MariaDB while ensuring the traffic stays within the Azure boundary. This policy provides a way to audit if the Azure Database for MariaDB has virtual network service endpoint being used.",
"metadata": {
"version": "1.0.2",
"category": "SQL"
},
"version": "1.0.2",
"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.DBforMariaDB/servers"
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"type": "Microsoft.DBforMariaDB/servers/virtualNetworkRules",
"existenceCondition": {
"field": "Microsoft.DBforMariaDB/servers/virtualNetworkRules/virtualNetworkSubnetId",
"exists": "true"
}
}
}
},
"versions": [
"1.0.2"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/dfbd9a64-6114-48de-a47d-90574dc2e489",
"name": "dfbd9a64-6114-48de-a47d-90574dc2e489"
}Bylawdfbd9a64-6114-48de-a47d-90574dc2e489.bylaw.ps1 · 28 lines
# Converted from MariaDB_VirtualNetworkServiceEndpoint_Audit.json by ConvertTo-Bylaw.
Policy 'dfbd9a64-6114-48de-a47d-90574dc2e489' {
Properties @{
DisplayName = 'MariaDB server should use a virtual network service endpoint'
Description = 'Virtual network based firewall rules are used to enable traffic from a specific subnet to Azure Database for MariaDB while ensuring the traffic stays within the Azure boundary. This policy provides a way to audit if the Azure Database for MariaDB has virtual network service endpoint being used.'
Version = '1.0.2'
Category = 'SQL'
PolicyVersion = '1.0.2'
Mode = 'Indexed'
}
Parameter Effect @{
Type = 'string'
AllowedValues = @('AuditIfNotExists', 'Disabled')
Default = 'AuditIfNotExists'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.DBforMariaDB/servers'
AuditIfNotExists 'Microsoft.DBforMariaDB/servers/virtualNetworkRules' -Effect (Param Effect) {
Require 'virtualNetworkSubnetId exists' {
Field virtualNetworkSubnetId | Must -Exist
}
}
}Source: built-in-policies/policyDefinitions/SQL/MariaDB_VirtualNetworkServiceEndpoint_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw