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

This command creates a new Azure SQL Database Failover Group.

Syntax

New-AzureRmSqlDatabaseFailoverGroup
   [-ResourceGroupName] <String>
   [-ServerName] <String>
   [-AllowReadOnlyFailoverToPrimary <AllowReadOnlyFailoverToPrimary>]
   -FailoverGroupName <String>
   [-FailoverPolicy <FailoverPolicy>]
   [-GracePeriodWithDataLossHours <Int32>]
   [-PartnerResourceGroupName <String>]
   -PartnerServerName <String>
   [<CommonParameters>]

Description

Creates a new Azure SQL Database Failover Group for the specified servers.

Two Azure SQL Database TDS endpoints are created at FailoverGroupName.SqlDatabaseDnsSuffix (for example, FailoverGroupName.database.windows.net) and FailoverGroupName.secondary.SqlDatabaseDnsSuffix. These endpoints may be used to connect to the primary and secondary servers in the Failover Group, respectively. If the primary server is affected by an outage, automatic failover of the endpoints and databases will be triggered as dictated by the Failover Group's failover policy and grace period.

Newly created Failover Groups do not contain any databases. To control the set of databases in a Failover Group, use the 'Add-AzureRmSqlDatabaseToFailoverGroup' and 'Remove-AzureRmSqlDatabaseFromFailoverGroup' cmdlets.

During preview of the Failover Groups feature, only values greater than or equal to 1 hour are supported for the '-GracePeriodWithDataLossHours' parameter.

Examples

Example 1

C:\> $failoverGroup = New-AzureRMSqlDatabaseFailoverGroup -ResourceGroupName rg -ServerName primaryserver -PartnerServerName secondaryserver -FailoverGroupName fg -FailoverPolicy Automatic -GracePeriodWithDataLossHours 1

This command creates a new Failover Group with failover policy 'Automatic' for two servers in the same resource group.

Example 2

C:\> $failoverGroup = New-AzureRMSqlDatabaseFailoverGroup -ResourceGroupName rg1 -ServerName primaryserver -PartnerResourceGroupName rg2 -PartnerServerName secondaryserver1 -FailoverGroupName fg -FailoverPolicy Manual

This command creates a new Failover Group with failover policy 'Manual' for two servers in different resource groups.

Required Parameters

-FailoverGroupName

The name of the Azure SQL Database Failover Group to create.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-PartnerServerName

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

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

-AllowReadOnlyFailoverToPrimary

Whether an outage on the secondary server should trigger automatic failover of the read-only endpoint. This feature is not yet supported.

Type:AllowReadOnlyFailoverToPrimary
Parameter Sets:Enabled, Disabled
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-FailoverPolicy

The failover policy of the Azure SQL Database Failover Group.

Type:FailoverPolicy
Parameter Sets:Automatic, Manual
Position:Named
Default value:Automatic
Accept pipeline input:False
Accept wildcard characters:False
-GracePeriodWithDataLossHours

Interval before automatic failover is initiated if an outage occurs on the primary server and failover cannot be completed without data loss.

Type:Int32
Position:Named
Default value:1
Accept pipeline input:False
Accept wildcard characters:False
-PartnerResourceGroupName

The name of the secondary resource group of the Azure SQL Database Failover Group.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Inputs

System.String

Outputs

System.Object