Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
Switch-AzSqlDatabaseInstanceFailoverGroup
- Module:
- Az.Sql Module
Executes a failover of an Instance Failover Group.
Syntax
SwitchInstanceFailoverGroupDefaultSet (Default)
Switch-AzSqlDatabaseInstanceFailoverGroup
[-ResourceGroupName] <String>
[-Location] <String>
[-Name] <String>
[-AllowDataLoss]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
SwitchInstanceFailoverGroupByResourceIdSet
Switch-AzSqlDatabaseInstanceFailoverGroup
[-Location] <String>
[-ResourceId] <String>
[-AllowDataLoss]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
SwitchInstanceFailoverGroupByInputObjectSet
Switch-AzSqlDatabaseInstanceFailoverGroup
[-InputObject] <AzureSqlInstanceFailoverGroupModel>
[-AllowDataLoss]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
This command swaps the roles of the managed instances in a Instance Failover Group by failing over to the specified secondary region, making it the new primary region. All new TDS sessions connecting to the primary endpoint are automatically re-routed to the new primary region.
Examples
Example 1
Get-AzSqlDatabaseInstanceFailoverGroup -ResourceGroupName rg -Location location -Name fg | Switch-AzSqlDatabaseInstanceFailoverGroup -AllowDataLoss
ResourceGroupName : rg
Location : East US
Name : fg
PartnerResourceGroupName : rg
PartnerRegion : West US
PrimaryManagedInstanceName : managedInstance1
PartnerManagedInstanceName : managedInstance2
ReplicationRole : Primary
ReplicationState : CATCH_UP
ReadWriteFailoverPolicy : Automatic
FailoverWithDataLossGracePeriodHours : 1
ReadOnlyFailoverPolicy : Disabled
Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/rg/providers/Microsoft.Sql/locations/eastus/instanceFailoverGroups/fg
Issue a failover operation allowing data loss by piping in the Instance Failover Group.
Example 2
Get-AzSqlDatabaseInstanceFailoverGroup -ResourceGroupName rg -Location location -Name fg | Switch-AzSqlDatabaseInstanceFailoverGroup
ResourceGroupName : rg
Location : East US
Name : fg
PartnerResourceGroupName : rg
PartnerRegion : West US
PrimaryManagedInstanceName : managedInstance1
PartnerManagedInstanceName : managedInstance2
ReplicationRole : Primary
ReplicationState : CATCH_UP
ReadWriteFailoverPolicy : Automatic
FailoverWithDataLossGracePeriodHours : 1
ReadOnlyFailoverPolicy : Disabled
Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/rg/providers/Microsoft.Sql/locations/eastus/instanceFailoverGroups/fg
Issue a best effort failover operation that will either succeed without losing data or fail and roll back.
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.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Confirm
Prompts you for confirmation before running the cmdlet.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | cf |
Parameter sets
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with Azure.
Parameter properties
| Type: | IAzureContextContainer |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | AzContext, AzureRmContext, AzureCredential |
Parameter sets
-InputObject
The Instance Failover Group object to switch
Parameter properties
| Type: | AzureSqlInstanceFailoverGroupModel |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Location
The name of the Local Region of the secondary instance in the Instance Failover Group.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Name
The name of the Instance Failover Group.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-ResourceGroupName
The name of the resource group of the secondary instance in the Instance Failover Group.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-ResourceId
The Resource ID of the Instance Failover Group to switch.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | wi |
Parameter sets
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Inputs
AzureSqlInstanceFailoverGroupModel
System.String
Outputs
AzureSqlInstanceFailoverGroupModel
Azure PowerShell
Feedback
Was this page helpful?
