New-AzureRmSqlDatabaseSecondary

Creates a secondary database for an existing database and starts data replication.

Important

Because Az PowerShell modules now have all the capabilities of AzureRM PowerShell modules and more, we'll retire AzureRM PowerShell modules on 29 February 2024.

To avoid service interruptions, update your scripts that use AzureRM PowerShell modules to use Az PowerShell modules by 29 February 2024. To automatically update your scripts, follow the quickstart guide.

Syntax

New-AzureRmSqlDatabaseSecondary
   [-DatabaseName] <String>
   [-SecondaryServiceObjectiveName <String>]
   [-SecondaryElasticPoolName <String>]
   [-Tags <Hashtable>]
   -PartnerResourceGroupName <String>
   -PartnerServerName <String>
   [-AllowConnections <AllowConnections>]
   [-AsJob]
   [-LicenseType <String>]
   [-ServerName] <String>
   [-ResourceGroupName] <String>
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzureRmSqlDatabaseSecondary
   [-DatabaseName] <String>
   [-Tags <Hashtable>]
   -PartnerResourceGroupName <String>
   -PartnerServerName <String>
   [-AllowConnections <AllowConnections>]
   [-AsJob]
   -SecondaryComputeGeneration <String>
   -SecondaryVCore <Int32>
   [-LicenseType <String>]
   [-ServerName] <String>
   [-ResourceGroupName] <String>
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

The New-AzureRMSqlDatabaseSecondary cmdlet replaces the Start-AzureSqlDatabaseCopy cmdlet when used for setting up geo-replication for a database. It returns the geo-replication link object from the primary to the secondary database.

Examples

1: Establish Active Geo-Replication

$database = Get-AzureRmSqlDatabase -DatabaseName $databasename -ResourceGroupName $primaryresourcegroupname -ServerName $primaryservername
$database | New-AzureRmSqlDatabaseSecondary -PartnerResourceGroupName $secondaryresourcegroupname -PartnerServerName $secondaryservername -AllowConnections "All"

Parameters

-AllowConnections

Specifies the read intent of the secondary Azure SQL Database. The acceptable values for this parameter are:

  • No
  • All
Type:AllowConnections
Accepted values:No, All
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-AsJob

Run cmdlet in the background

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

Specifies the name of the database to act as primary.

Type:String
Position:2
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-DefaultProfile

The credentials, account, tenant, and subscription used for communication with azure

Type:IAzureContextContainer
Aliases:AzureRmContext, AzureCredential
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-LicenseType

The license type for the Azure Sql database.

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

Specifies the name of the Azure Resource Group to which this cmdlet assigns the secondary database.

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

Specifies the name of the Azure SQL database server to act as secondary.

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

Specifies the name of the Azure Resource Group to which this cmdlet assigns the primary database.

Type:String
Position:0
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-SecondaryComputeGeneration

The compute generation of teh Azure Sql Database secondary.

Type:String
Aliases:Family
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-SecondaryElasticPoolName

Specifies the name of the elastic pool in which to put the secondary database.

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

Specifies the name of the service objective to assign to the secondary database.

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

The Vcore numbers of the Azure Sql Database secondary.

Type:Int32
Aliases:Capacity
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ServerName

Specifies the name of the SQL Server of the primary SQL Database.

Type:String
Position:1
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-Tags

Specifies the Key-value pairs in the form of a hash table to associate with the SQL Database replication link. For example: @{key0="value0";key1=$null;key2="value2"}

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

Inputs

String

Outputs

AzureReplicationLinkModel