Skip to main content

Triage and Remediation

Remediation

Using Console

To remediate the misconfiguration of “Enable Automatic Failover” in Azure, please follow the below steps:
  1. Log in to the Azure portal at https://portal.azure.com/
  2. Navigate to the Azure SQL database that you want to remediate.
  3. Click on “Failover Groups” in the left-hand menu.
  4. Click on “Add Failover Group.”
  5. In the “Add Failover Group” blade, provide the following details:
    • Name: A unique name for the failover group.
    • Subscription: The subscription associated with the failover group.
    • Resource group: The resource group associated with the failover group.
    • Primary region: The region where the primary database is located.
    • Secondary region: The region where the secondary database is located.
  6. Click on “Create” to create the failover group.
  7. Once the failover group is created, click on it to open the “Failover Group” blade.
  8. In the “Failover Group” blade, click on “Add Secondary.”
  9. In the “Add Secondary” blade, provide the following details:
    • Subscription: The subscription associated with the secondary database.
    • Server: The server where the secondary database is located.
    • Database: The name of the secondary database.
    • Auto-failover: Select the “On” option to enable automatic failover.
  10. Click on “Create” to add the secondary database to the failover group.
Once you have completed these steps, automatic failover will be enabled for the Azure SQL database.

To enable automatic failover in Azure using Azure CLI, follow these steps:
  1. Open the Azure CLI command prompt.
  2. Log in to your Azure account using the command: az login
  3. Once you are logged in, select the desired subscription using the command: az account set --subscription <subscription_id>
  4. Enable automatic failover for the desired Azure SQL Database using the command: az sql failover-group update --name <failover_group_name> --resource-group <resource_group_name> --partner-server <partner_server_name> --failover-policy Automatic Replace the following parameters:
    • <failover_group_name>: The name of the failover group that you want to update.
    • <resource_group_name>: The name of the resource group that contains the failover group.
    • <partner_server_name>: The name of the partner server to which you want to fail over.
    • Automatic: This parameter specifies that the failover policy should be set to automatic.
  5. Verify that automatic failover has been enabled by checking the failover policy using the command: az sql failover-group show --name <failover_group_name> --resource-group <resource_group_name> This command will return the details of the failover group, including the failover policy.
That’s it! You have successfully enabled automatic failover for an Azure SQL Database using Azure CLI.
To remediate the misconfiguration of enabling automatic failover in Azure using Python, you can follow the below steps:
  1. Import the required libraries:
  1. Set the required credentials:
  1. Get the Redis cache instance:
  1. Update the Redis cache instance to enable automatic failover:
This will enable automatic failover for the Redis cache instance in Azure.
Changing automatic_failover_enabled and adding secondary geo_location entries is an in-place update for the Cosmos DB account and should not force resource replacement, though Cosmos will perform online replication to the new region.To verify, terraform plan should show automatic_failover_enabled changing from false to true (or being added as true) and at least one new geo_location block with failover_priority ≥ 1 being created or updated.