Synopsis
Creates, updates, or removes a PostgreSQL Failover Group within an Azure Database for PostgreSQL server.
Syntax
New-AzPostgreSqlFailoverGroup
    -Name <String>
    -ResourceGroupName <String>
    -ServerName <String>
    [-PartnerServer <String>]
    [-PartnerResourceGroupName <String>]
    [-Location <String>]
    [-Tag <Hashtable>]
    []
Set-AzPostgreSqlFailoverGroup
    -Name <String>
    -ResourceGroupName <String>
    -ServerName <String>
    [-Tag <Hashtable>]
    []
Remove-AzPostgreSqlFailoverGroup
    -Name <String>
    -ResourceGroupName <String>
    -ServerName <String>
    [-Force]
    []
Get-AzPostgreSqlFailoverGroup
    [-ResourceGroupName <String>]
    [-ServerName <String>]
    [-Name <String>]
    []
Restore-AzPostgreSqlFailoverGroup
    -Name <String>
    -ResourceGroupName <String>
    -ServerName <String>
    -TargetServerName <String>
    [-TargetResourceGroupName <String>]
    []
     Parameters
| Parameter | Type | Required | Description | 
|---|---|---|---|
| -Name | String | Yes | Name of the failover group. | 
| -ResourceGroupName | String | Yes | Name of the resource group containing the primary server. | 
| -ServerName | String | Yes | Primary PostgreSQL server name. | 
| -PartnerServer | String | No | Secondary (partner) server name. | 
| -PartnerResourceGroupName | String | No | Resource group of the partner server. | 
| -Location | String | No | Azure region for the failover group. | 
| -Tag | Hashtable | No | Tags assigned to the failover group. | 
| -Force | SwitchParameter | No | Suppress confirmation prompts. | 
| -TargetServerName | String | Yes (Restore) | Server to which the failover group will be restored. | 
| -TargetResourceGroupName | String | No (Restore) | Resource group of the target server. | 
Examples
Example 1: Create a new failover group
# Create a failover group named 'myFailoverGroup' between server 'pgprimary' and 'pgsecondary'
New-AzPostgreSqlFailoverGroup `
    -Name "myFailoverGroup" `
    -ResourceGroupName "rg-prod" `
    -ServerName "pgprimary" `
    -PartnerServer "pgsecondary" `
    -PartnerResourceGroupName "rg-prod" `
    -Location "West Europe"
Example 2: Update tags on an existing failover group
Set-AzPostgreSqlFailoverGroup `
    -Name "myFailoverGroup" `
    -ResourceGroupName "rg-prod" `
    -ServerName "pgprimary" `
    -Tag @{Environment="Production";Owner="DBTeam"}
Example 3: Get details of a failover group
Get-AzPostgreSqlFailoverGroup `
    -Name "myFailoverGroup" `
    -ResourceGroupName "rg-prod" `
    -ServerName "pgprimary"
Example 4: Remove a failover group
Remove-AzPostgreSqlFailoverGroup `
    -Name "myFailoverGroup" `
    -ResourceGroupName "rg-prod" `
    -ServerName "pgprimary" `
    -Force
Notes
- Failover groups enable automatic or manual failover of read replicas across Azure regions.
- The partner server must be in a different Azure region for geo-redundant failover.
- Use Restore-AzPostgreSqlFailoverGroupto recover a failover group after a disaster.