New-AzSqlDatabaseSecondary
Creates a secondary database for an existing database and starts data replication.
Note
This is the previous version of our documentation. Please consult the most recent version for up-to-date information.
Syntax
New-AzSqlDatabaseSecondary
[-DatabaseName] <String>
[-SecondaryServiceObjectiveName <String>]
[-SecondaryElasticPoolName <String>]
[-Tags <Hashtable>]
-PartnerResourceGroupName <String>
-PartnerServerName <String>
[-PartnerDatabaseName <String>]
[-AllowConnections <AllowConnections>]
[-AsJob]
[-LicenseType <String>]
[-BackupStorageRedundancy <String>]
[-SecondaryType <String>]
[-HighAvailabilityReplicaCount <Int32>]
[-ServerName] <String>
[-ResourceGroupName] <String>
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzSqlDatabaseSecondary
[-DatabaseName] <String>
[-Tags <Hashtable>]
-PartnerResourceGroupName <String>
-PartnerServerName <String>
[-PartnerDatabaseName <String>]
[-AllowConnections <AllowConnections>]
[-AsJob]
-SecondaryComputeGeneration <String>
-SecondaryVCore <Int32>
[-LicenseType <String>]
[-BackupStorageRedundancy <String>]
[-SecondaryType <String>]
[-HighAvailabilityReplicaCount <Int32>]
[-ServerName] <String>
[-ResourceGroupName] <String>
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
The New-AzSqlDatabaseSecondary cmdlet replaces the Start-AzSqlDatabaseCopy 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
Example 1: Establish Active Geo-Replication
$database = Get-AzSqlDatabase -DatabaseName $databasename -ResourceGroupName $primaryresourcegroupname -ServerName $primaryservername
$database | New-AzSqlDatabaseSecondary -PartnerResourceGroupName $secondaryresourcegroupname -PartnerServerName $secondaryservername -AllowConnections "All"
Example 2: Establish Active Geo-Replication and specify the partner database name to be different than the source database name
$database = Get-AzSqlDatabase -DatabaseName $databasename -ResourceGroupName $primaryresourcegroupname -ServerName $primaryservername
$database | New-AzSqlDatabaseSecondary -PartnerResourceGroupName $secondaryresourcegroupname -PartnerServerName $secondaryservername -PartnerDatabaseName $secondarydatabasename -AllowConnections "All"
Parameters
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 |
Run cmdlet in the background
| Type: | SwitchParameter |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
The Backup storage redundancy used to store backups for the SQL Database. Options are: Local, Zone and Geo.
| Type: | String |
| Accepted values: | Local, Zone, Geo |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
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 |
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 |
The credentials, account, tenant, and subscription used for communication with azure
| Type: | IAzureContextContainer |
| Aliases: | AzContext, AzureRmContext, AzureCredential |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
The number of readonly secondary replicas associated with the database to which readonly application intent connections may be routed. This property is only settable for Hyperscale edition databases.
| Type: | Int32 |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
The license type for the Azure Sql database.
| Type: | String |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
The name of the secondary database to create.
| Type: | String |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
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 |
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 |
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 |
The compute generation of the Azure Sql Database secondary.
| Type: | String |
| Aliases: | Family |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
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 |
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 |
The secondary type of the database if it is a secondary. Valid values are Geo and Named.
| Type: | String |
| Accepted values: | Named, Geo |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
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 |
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 |
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 |
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 |