Azure Database SQL Server Failover Group
This page shows how to write Terraform and Azure Resource Manager for Database SQL Server Failover Group and write them securely.
azurerm_mssql_failover_group (Terraform)
The SQL Server Failover Group in Database can be configured in Terraform with the resource name azurerm_mssql_failover_group
. The following sections describe how to use the resource and its parameters.
Example Usage from GitHub
An example could not be found in GitHub.
Parameters
The following arguments are supported:
name
- (Required) The name of the Failover Group. Changing this forces a new resource to be created.server_id
- (Required) The ID of the primary SQL Server on which to create the failover group. Changing this forces a new resource to be created.partner_server
- (Required) Apartner_server
block as defined below.databases
- (Optional) A set of database names to include in the failover group.readonly_endpoint_failover_policy_enabled
- (Optional) Whether failover is enabled for the readonly endpoint. Defaults tofalse
.read_write_endpoint_failover_policy
- (Required) Aread_write_endpoint_failover_policy
block as defined below.tags
- (Optional) A mapping of tags to assign to the resource.
A partner_server
block supports the following:
id
- (Required) The ID of a partner SQL server to include in the failover group.
The read_write_endpoint_failover_policy
block supports the following:
mode
- (Required) The failover policy of the read-write endpoint for the failover group. Possible values areAutomatic
orManual
.grace_minutes
- (Optional) The grace period in minutes, before failover with data loss is attempted for the read-write endpoint. Required whenmode
isAutomatic
.
The following attributes are exported:
id
- The ID of the Failover Group.partner_server
- Apartner_server
block as defined below.
A partner_server
block exports the following:
location
- The location of the partner server.role
- The replication role of the partner server. Possible values includePrimary
orSecondary
.
Explanation in Terraform Registry
Manages a Microsoft Azure SQL Failover Group.
Tips: Best Practices for The Other Azure Database Resources
In addition to the azurerm_mariadb_firewall_rule, Azure Database has the other resources that should be configured for security reasons. Please check some examples of those resources and precautions.
azurerm_mariadb_firewall_rule
Ensure database firewalls do not permit public access
It is better to restrict IP address ranges that can access the database by firewall rules. If both start_ip_address and end_ip_address are set to 0.0.0.0, it blocks connections from the Internet and accepts connections from all Azure datacenter IP addresses.
azurerm_mariadb_server
Ensure that access to Azure SQL Database is restricted
It is better to disable public access to the database to avoid unwilling communications with unknown services if not required.
azurerm_mssql_database_extended_auditing_policy
Ensure to configure retention periods of database auditing to enough duration
It is better to configure retention periods of database auditing to enough duration. It would be better to set greater than at least 90 days.
azurerm_mssql_server
Ensure to enable auditing on Azure SQL databases
It is better to enable auditing on Azure SQL databases. It helps you maintain regulatory compliance, monitor the activities indicating unexpected incidents or suspected security violations.
azurerm_mssql_server_security_alert_policy
Ensure to configure at least one email address for threat alerts
It is better to configure at least one email address for threat alerts. SQL Server is able to send alerts for threat detection via emails and it could support us to notice the incident on time.
azurerm_mysql_firewall_rule
Ensure database firewalls do not permit public access
It is better to restrict IP address ranges that can access the database by firewall rules. If both start_ip_address and end_ip_address are set to 0.0.0.0, it blocks connections from the Internet and accepts connections from all Azure datacenter IP addresses.
azurerm_mysql_server
Ensure to disable public access to database
It is better to disable public access to the database to avoid unwilling communications with unknown services if not required.
azurerm_postgresql_firewall_rule
Ensure database firewalls do not permit public access
It is better to restrict IP address ranges that can access the database by firewall rules. If both start_ip_address and end_ip_address are set to 0.0.0.0, it blocks connections from the Internet and accepts connections from all Azure datacenter IP addresses.
azurerm_postgresql_server
Ensure to disable public access to database
It is better to disable public access to the database to avoid unwilling communications with unknown services if not required.
azurerm_sql_firewall_rule
Ensure database firewalls do not permit public access
It is better to restrict IP address ranges that can access the database by firewall rules. If both start_ip_address and end_ip_address are set to 0.0.0.0, it blocks connections from the Internet and accepts connections from all Azure datacenter IP addresses.
azurerm_sql_server
Ensure to enable auditing on Azure SQL databases
It is better to enable auditing on Azure SQL databases. It helps you maintain regulatory compliance, monitor the activities indicating unexpected incidents or suspected security violations.
Microsoft.Sql/servers/failoverGroups (Azure Resource Manager)
The servers/failoverGroups in Microsoft.Sql can be configured in Azure Resource Manager with the resource name Microsoft.Sql/servers/failoverGroups
. The following sections describe how to use the resource and its parameters.
Example Usage from GitHub
"type": "Microsoft.Sql/servers/failoverGroups",
"location": "Japan East",
"properties": {
"readWriteEndpoint": {
"failoverPolicy": "Automatic",
"failoverWithDataLossGracePeriodMinutes": 480
"type": "Microsoft.Sql/servers/failoverGroups",
"location": "Japan East",
"properties": {
"readWriteEndpoint": {
"failoverPolicy": "Automatic",
"failoverWithDataLossGracePeriodMinutes": 480
"type": "Microsoft.Sql/servers/failoverGroups",
"location": "Japan East",
"properties": {
"readWriteEndpoint": {
"failoverPolicy": "Automatic",
"failoverWithDataLossGracePeriodMinutes": 480
"type": "Microsoft.Sql/servers/failoverGroups",
"location": "Japan East",
"properties": {
"readWriteEndpoint": {
"failoverPolicy": "Automatic",
"failoverWithDataLossGracePeriodMinutes": 480
"type": "Microsoft.Sql/servers/failoverGroups",
"location": "Japan East",
"properties": {
"readWriteEndpoint": {
"failoverPolicy": "Automatic",
"failoverWithDataLossGracePeriodMinutes": 480
"type": "Microsoft.Sql/servers/failoverGroups",
"location": "Japan East",
"properties": {
"readWriteEndpoint": {
"failoverPolicy": "Automatic",
"failoverWithDataLossGracePeriodMinutes": 480
"type": "Microsoft.Sql/servers/failoverGroups",
"location": "Japan East",
"properties": {
"readWriteEndpoint": {
"failoverPolicy": "Automatic",
"failoverWithDataLossGracePeriodMinutes": 480
"type": "Microsoft.Sql/servers/failoverGroups",
"location": "Japan East",
"properties": {
"readWriteEndpoint": {
"failoverPolicy": "Automatic",
"failoverWithDataLossGracePeriodMinutes": 480
"type": "Microsoft.Sql/servers/failoverGroups",
"location": "Japan East",
"properties": {
"readWriteEndpoint": {
"failoverPolicy": "Automatic",
"failoverWithDataLossGracePeriodMinutes": 480
"type": "Microsoft.Sql/servers/failoverGroups",
"location": "Japan East",
"properties": {
"readWriteEndpoint": {
"failoverPolicy": "Automatic",
"failoverWithDataLossGracePeriodMinutes": 480