Azure PowerShell

AzMySQLFailoverGroup Cmdlet

The AzMySQLFailoverGroup cmdlets let you create, manage, and monitor failover groups for Azure Database for MySQL servers.

Syntax

New-AzMySQLFailoverGroup
    -Name <String>
    -ResourceGroupName <String>
    -ServerName <String>
    -PartnerServer <String>
    [-PartnerResourceGroupName <String>]
    [-Location <String>]
    [-ReadWriteEndpointFailoverPolicy <String>]
    [-ReadOnlyEndpointFailoverPolicy <String>]
    [-Tag <Hashtable>]
    []

Get-AzMySQLFailoverGroup
    [-ResourceGroupName <String>]
    [-ServerName <String>]
    [-Name <String>]
    []

Remove-AzMySQLFailoverGroup
    -Name <String>
    -ResourceGroupName <String>
    -ServerName <String>
    [-Force]
    []

Set-AzMySQLFailoverGroup
    -Name <String>
    -ResourceGroupName <String>
    -ServerName <String>
    [-ReadWriteEndpointFailoverPolicy <String>]
    [-ReadOnlyEndpointFailoverPolicy <String>]
    [-Tag <Hashtable>]
    []

Parameters

ParameterDescription
-NameName of the failover group.
-ResourceGroupNameResource group containing the primary server.
-ServerNamePrimary MySQL server name.
-PartnerServerSecondary server that participates in the failover group.
-ReadWriteEndpointFailoverPolicyPolicy for automatic failover of the read‑write endpoint. Possible values: Automatic, Manual.
-ReadOnlyEndpointFailoverPolicyPolicy for the read‑only endpoint. Options: Enabled, Disabled.
-TagHashtable of tags to assign to the failover group.
-ForceSuppresses confirmation prompts for removal.

Example 1: Create a Failover Group

New-AzMySQLFailoverGroup `
    -Name "MyFailoverGroup" `
    -ResourceGroupName "ProdRG" `
    -ServerName "myprimaryserver" `
    -PartnerServer "mysecondaryserver" `
    -ReadWriteEndpointFailoverPolicy Automatic `
    -ReadOnlyEndpointFailoverPolicy Enabled

Example 2: Retrieve Failover Group Details

Get-AzMySQLFailoverGroup -ResourceGroupName "ProdRG" -ServerName "myprimaryserver" -Name "MyFailoverGroup"

Example 3: Update Failover Policy

Set-AzMySQLFailoverGroup `
    -Name "MyFailoverGroup" `
    -ResourceGroupName "ProdRG" `
    -ServerName "myprimaryserver" `
    -ReadWriteEndpointFailoverPolicy Manual