Switch-​Azure​Rm​Sql​Database​Failover​Group

Executes a failover of an Azure SQL Database Failover Group.

Syntax

Switch-AzureRmSqlDatabaseFailoverGroup
      [-ResourceGroupName] <String>
      [-ServerName] <String>
      [[-FailoverGroupName] <String>]
      [-AllowDataLoss]
      [-Confirm]
      [-WhatIf]
      [<CommonParameters>]

Description

This command swaps the roles of the servers in a Failover Group and switches all secondary databases to the primary role. All new TDS sessions are automatically re-routed to the secondary server after the DNS client cache is refreshed. When the original primary server is back online, all formerly primary databases in it will switch to the secondary role.

The Failover Group's secondary server must be used to execute this command.

Examples

Example 1

C:\> Get-AzureRmSqlDatabaseFailoverGroup -ResourceGroupName rg -ServerName secondaryserver -FailoverGroupName fg | Switch-AzureRmSqlDatabaseFailoverGroup -AllowDataLoss

Issue a failover operation allowing data loss by piping in the Failover Group.

Example 2

C:\> Switch-AzureRmSqlDatabaseFailoverGroup -ResourceGroupName rg -ServerName secondaryserver -FailoverGroupName fg

Issue a best effort failover operation that will either succeed without losing data or fail and roll back.

Required Parameters

-ResourceGroupName

The name of the resource group.

Type:String
Position:0
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-ServerName

The name of the secondary Azure SQL Database Server of the Failover Group.

Type:String
Position:1
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False

Optional Parameters

-AllowDataLoss

Complete the failover even if doing so may result in data loss. This will allow the failover to proceed even if a primary database is unavailable.

Type:SwitchParameter
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False
-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False
-FailoverGroupName

The name of the Azure SQL Database Failover Group.

Type:String
Position:2
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

System.String

Outputs

System.Object