Remove-​Azure​Rm​Sql​Database​From​Failover​Group

The Cmdlet that drops databases from the Azure SQL Failover Group.

Syntax

Remove-AzureRmSqlDatabaseFromFailoverGroup
      -Databases <System.Collections.Generic.List`1[Microsoft.Azure.Commands.Sql.Database.Model.AzureSqlDatabaseModel]>
      -FailoverGroupName <String>
      -ResourceGroupName <String>
      -ServerName <String>
      [-Tags <Hashtable>]
      [-Confirm]
      [-WhatIf]
      [<CommonParameters>]

Description

This command must be executed on the primary server. The command drops the corresponding secondary databases on all secondary servers and unregisters the read-write databases from the FG. The database input parameter is a Azure Sql Database Model and it should be either piped in or passed in as a environmental variable.

Examples

Example 1

Remove one database from the Failover Group

PS C:\> Get-AzureRmSqlDatabase -ServerName testsvr -ResourceGroupName myrg2 -DatabaseName testdb | Remove-AzureRmSqlDatabaseFromFailoverGroup -FailoverGroupName testfg -ResourceGroupName rg2 -ServerName testsvr

Example 2

Remove all databases in a server from the Failover Group

PS C:\> Get-AzureRmSqlDatabase -ServerName testsvr -ResourceGroupName myrg2 | Remove-AzureRmSqlDatabaseFromFailoverGroup -FailoverGroupName testfg -ResourceGroupName rg2 -ServerName testsvr

Required Parameters

-Databases

The Azure SQL Databases to be added to the secondary server.

Type:System.Collections.Generic.List`1[Microsoft.Azure.Commands.Sql.Database.Model.AzureSqlDatabaseModel]
Position:Named
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-FailoverGroupName

The name of the Azure SQL Failover Group.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-ResourceGroupName

The name of the resource group.

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

Optional Parameters

-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
-Tags

The tag to associate with the Azure Sql Elastic Pool

Type:Hashtable
Aliases:Tag
Position:Named
Default value:None
Accept pipeline input:False
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