Description
azurerm_mysql_server represents Azure Database for MySQL Single Server, which retired on September 16, 2024. When reviewing these older configurations, distinguish the server’s public network setting from its firewall, authentication and database permissions.
Potential impact
Broad public firewall rules can admit unwanted sign-in attempts. Relying on a retired service configuration also complicates maintenance and recovery.
Remediation
Choose the network mode when creating the MySQL Flexible Server migration target. VNet integration has no public endpoint. For a server created in public-access mode, test the private endpoint and DNS from an application before disabling public access. If a public path is required, restrict the firewall to approved client sources. Limit database accounts and permissions separately.
Examples
The Single Server excerpts omit required settings such as SKU and version. Supply a protected administrator password for any real deployment.
Before
resource "azurerm_mysql_server" "app_db" {
name = "example-mysqlserver"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
administrator_login = "mysqladminun"
administrator_login_password = "H@Sh1CoR3!"
}
The legacy configuration omits the public network flag.
After
resource "azurerm_mysql_server" "app_db" {
name = "example-mysqlserver"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
administrator_login = "mysqladminun"
administrator_login_password = "H@Sh1CoR3!"
public_network_access_enabled = false
}
On Single Server, public_network_access_enabled = false disabled public access. Verify the required connection path on the destination server.