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

The Cmdlet that issues failover operation on Azure SQL Failover Group

Syntax

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

Description

This command must be executed on a secondary server of a specific FG. The FG is identified by the listener name. The command switches all secondary databases to the primary role. All active TDS sessions will be disconnected. All new TDS sessions will be automatically re-routed to the secondary server, which now becomes primary server. When the original primary server is back online it will automatically become the secondary server and all formerly primary databases in it will switch to the secondary role.

Examples

Example 1

Issue failover operation with data loss
PS C:\> C:\> $ag | Switch-AzureRMSqlDatabaseFailoverGroup -AllowDataLoss

Example 1

Issue failover operation without data loss
PS C:\> C:\> $ag | Switch-AzureRMSqlDatabaseFailoverGroup

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 Azure SQL Server the Failover Group is in.

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

Optional Parameters

-AllowDataLoss

Whether this failover operation will allow data loss.

Type:SwitchParameter
Position:Named
Default value:None
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:None
Accept pipeline input:False
Accept wildcard characters:False
-FailoverGroupName

The name of the Azure SQL Failover Group to retrieve.

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:None
Accept pipeline input:False
Accept wildcard characters:False

Inputs

System.String

Outputs

System.Object