Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Azure Database for MySQL is a fully managed relational database service that provides high availability, automated backups, and scalable MySQL-compatible database hosting. Securing your flexible server deployments helps protect sensitive data, reduce identity and network exposure, and support compliance requirements.
This article provides security recommendations to help protect your Azure Database for MySQL deployment.
The security recommendations in this article implement Zero Trust principles: "Verify explicitly", "Use least privilege access", and "Assume breach". For comprehensive Zero Trust guidance, see the Zero Trust Guidance Center.
Network security
Network security controls help restrict how clients reach Azure Database for MySQL flexible server instances and reduce exposure to public internet traffic.
- Disable public network access for production servers: Disable public access when clients can connect through private endpoints so only private connectivity paths can reach the flexible server. For more information, see Private Link for Azure Database for MySQL - Flexible Server.
- Use private endpoints for public-access servers: Use Private Link to expose the flexible server through a private IP address in your virtual network and limit data access to approved private endpoint connections. For more information, see Private Link for Azure Database for MySQL - Flexible Server.
- Deploy private-access servers with virtual network integration: Use virtual network integration when the flexible server must be injected into a delegated subnet and accessed only from the same virtual network, peered virtual networks, VPN, or ExpressRoute. For more information, see Private Network Access using virtual network integration for Azure Database for MySQL - Flexible Server.
- Limit public firewall rules: Use public firewall rules only for scenarios that require public connectivity, allow only specific IPv4 ranges, and avoid the option that permits access from all Azure services because it can allow connections from other customers' subscriptions. For more information, see Public Network Access for Azure Database for MySQL - Flexible Server.
Identity and access management
Identity and access controls help centralize authentication, reduce credential exposure, and enforce least privilege for both Azure management operations and database access.
- Use Microsoft Entra authentication for database access: Configure Microsoft Entra authentication for Azure Database for MySQL flexible server so users and applications can authenticate with Microsoft Entra identities instead of relying only on MySQL passwords. For more information, see Microsoft Entra authentication for Azure Database for MySQL - Flexible Server.
- Use Microsoft Entra-only authentication when possible: Disable MySQL native authentication after you migrate users and applications to Microsoft Entra authentication to reduce password-based access paths to the flexible server. For more information, see Microsoft Entra authentication for Azure Database for MySQL - Flexible Server.
- Use managed identities for application connections: Use managed identities or service principals with Microsoft Entra authentication so applications connect to Azure Database for MySQL with tokens instead of embedded database passwords. For more information, see Microsoft Entra authentication for Azure Database for MySQL - Flexible Server.
- Assign least-privilege database permissions: Create dedicated MySQL users or Microsoft Entra-mapped database users for each application or administrative function, and grant only the schema, table, and operation permissions each identity needs. For more information, see Create users in Azure Database for MySQL.
- Enforce Conditional Access for Azure Database for MySQL administrators: Apply Conditional Access policies that require multifactor authentication for identities that can manage flexible server resources through Azure Resource Manager tools such as the Azure portal, Azure CLI, and Azure PowerShell. For more information, see Require MFA for Azure management.
Data protection
Azure Database for MySQL encrypts data at rest with service-managed keys by default. The following controls give you more control over encryption, key management, and encrypted client connections.
- Require encrypted client connections: Keep
require_secure_transportenabled so client connections to Azure Database for MySQL use TLS encryption and don't send database traffic in clear text. For more information, see Transport Layer Security (TLS) in Azure Database for MySQL. - Enforce TLS 1.3 for MySQL 8.0 servers: Set
tls_versiontoTLS 1.3on Azure Database for MySQL 8.0 flexible servers after you confirm that client applications and drivers support TLS 1.3. For more information, see Transport Layer Security (TLS) in Azure Database for MySQL. - Validate server certificates from clients: Configure client applications to validate the server certificate chain and trust only root certificate authorities so routine intermediate CA or server certificate rotations don't break secure connections. For more information, see Transport Layer Security (TLS) in Azure Database for MySQL.
- Use customer-managed keys for key control: Use customer-managed keys stored in Azure Key Vault or Azure Key Vault Managed HSM when you need separation of duties, customer-controlled key lifecycle management, or more compliance controls for data-at-rest encryption. For more information, see Data encryption with customer managed keys for Azure Database for MySQL.
- Protect customer-managed key dependencies: Enable soft delete and purge protection on the Key Vault or Managed HSM that stores the customer-managed key, assign the required key permissions to the server's user-assigned managed identity, and monitor key access because loss of key access can make the flexible server inaccessible. For more information, see Data encryption with customer managed keys for Azure Database for MySQL.
Logging and monitoring
Logging and monitoring controls help you detect suspicious database activity, investigate administrative changes, and preserve audit evidence for compliance.
- Enable MySQL audit logs: Set
audit_log_enabledtoON, choose the audit event types that match your security and compliance requirements, and capture connection, administrative, DDL, and DML events for investigation. For more information, see Tutorial: Configure audit logs by using Azure Database for MySQL - Flexible Server. - Route audit logs to Azure Monitor: Configure diagnostic settings to send the
MySqlAuditLogsresource log category to a Log Analytics workspace, event hub, or storage account so you can query audit events in theAzureDiagnosticstable, retain evidence, and integrate database audit events with security operations workflows. For more information, see Tutorial: Configure audit logs by using Azure Database for MySQL - Flexible Server. - Use the auditing workbook: Use the built-in Azure Monitor auditing workbook for Azure Database for MySQL to review administrative actions, audit summaries, connection events, table access summaries, and identified errors. For more information, see Tutorial: Configure audit logs by using Azure Database for MySQL - Flexible Server.
- Enable Defender for open-source relational databases: Enable Microsoft Defender for open-source relational databases in Microsoft Defender for Cloud so Azure Database for MySQL flexible server instances can generate alerts for anomalous or potentially harmful database activity. For more information, see Enable Defender for open-source relational databases on Azure.
Compliance and governance
Compliance and governance controls help you enforce consistent secure configuration across Azure Database for MySQL flexible server fleets and protect production resources from accidental or unauthorized changes.
- Enforce diagnostic logging with Azure Policy: Assign built-in Azure Policy definitions for
microsoft.dbformysql/flexibleserversdiagnostic settings, such as policies that route logs to Log Analytics, Event Hubs, or Storage, so flexible server audit data is collected consistently. For more information, see Azure Policy built-in policy definitions. - Apply deletion locks to production servers: Add a
CanNotDeletelock to production Azure Database for MySQL flexible server resources to reduce the risk of accidental deletion while preserving normal operational changes. For more information, see Lock your Azure resources to protect your infrastructure. - Tag database resources for governance: Apply tags such as workload, environment, data classification, owner, and cost center to Azure Database for MySQL flexible server resources so policy assignments, inventory queries, and cost reviews can distinguish production and sensitive database workloads. For more information, see Use tags to organize your Azure resources and management hierarchy.
Backup and recovery
Backup and recovery controls help you recover from accidental deletion, data corruption, regional outages, and risky change operations.
- Configure backup retention for recovery objectives: Set the Azure Database for MySQL flexible server backup retention period between 1 and 35 days based on your workload recovery point requirements and compliance needs. For more information, see Backup and restore in Azure Database for MySQL.
- Use geo-redundant backup for regional recovery: Enable geo-redundant backup storage when you need backup replication to a paired region and the ability to geo-restore after a regional outage. For more information, see Overview of business continuity with Azure Database for MySQL - Flexible Server.
- Trigger on-demand backups before high-risk changes: Create an on-demand backup before schema migrations, major configuration changes, or maintenance operations to keep a recent restore point aligned with the server's backup retention policy. For more information, see Trigger on-demand backup of an Azure Database for MySQL - Flexible Server instance by using the Azure portal.
- Test restore procedures: Validate point-in-time restore and geo-restore procedures for representative workloads so you understand the server settings, tags, network rules, and post-restore actions required during recovery. For more information, see Backup and restore in Azure Database for MySQL.