Gallery › SQL › Azure built-in policies
Azure MySQL flexible server should have Microsoft Entra Only Authentication enabled
Converted Policy AuditIfNotExists Disabled Mode Indexed Version 1.0.1
Disabling local authentication methods and allowing only Microsoft Entra Authentication improves security by ensuring that Azure MySQL flexible server can exclusively be accessed by Microsoft Entra identities.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONMySQL_FlexibleServers_ADOnlyEnabled_Audit.json · 50 lines
{
"properties": {
"displayName": "Azure MySQL flexible server should have Microsoft Entra Only Authentication enabled",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Disabling local authentication methods and allowing only Microsoft Entra Authentication improves security by ensuring that Azure MySQL flexible server can exclusively be accessed by Microsoft Entra identities.",
"metadata": {
"version": "1.0.1",
"category": "SQL"
},
"version": "1.0.1",
"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.DBForMySql/flexibleServers"
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"type": "Microsoft.DBForMySql/flexibleServers/configurations",
"name": "aad_auth_only",
"existenceCondition": {
"field": "Microsoft.DBForMySql/flexibleServers/configurations/value",
"equals": "ON"
}
}
}
},
"versions": [
"1.0.1",
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/40e85574-ef33-47e8-a854-7a65c7500560",
"name": "40e85574-ef33-47e8-a854-7a65c7500560"
}Bylaw40e85574-ef33-47e8-a854-7a65c7500560.bylaw.ps1 · 28 lines
# Converted from MySQL_FlexibleServers_ADOnlyEnabled_Audit.json by ConvertTo-Bylaw.
Policy '40e85574-ef33-47e8-a854-7a65c7500560' {
Properties @{
DisplayName = 'Azure MySQL flexible server should have Microsoft Entra Only Authentication enabled'
Description = 'Disabling local authentication methods and allowing only Microsoft Entra Authentication improves security by ensuring that Azure MySQL flexible server can exclusively be accessed by Microsoft Entra identities.'
Version = '1.0.1'
Category = 'SQL'
PolicyVersion = '1.0.1'
Mode = 'Indexed'
}
Parameter Effect @{
Type = 'string'
AllowedValues = @('AuditIfNotExists', 'Disabled')
Default = 'AuditIfNotExists'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.DBForMySql/flexibleServers'
AuditIfNotExists 'Microsoft.DBForMySql/flexibleServers/configurations' -Name 'aad_auth_only' -Effect (Param Effect) {
Require 'value is ON' {
Field value | Must -Be 'ON'
}
}
}Source: built-in-policies/policyDefinitions/SQL/MySQL_FlexibleServers_ADOnlyEnabled_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw