Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
New-AzSqlDatabaseSecondary
- Module:
- Az.Sql Module
Creates a secondary database for an existing database and starts data replication.
Syntax
DtuBasedDatabase (Default)
New-AzSqlDatabaseSecondary
[-DatabaseName] <String>
[-ServerName] <String>
[-ResourceGroupName] <String>
-PartnerResourceGroupName <String>
-PartnerServerName <String>
[-SecondaryServiceObjectiveName <String>]
[-SecondaryElasticPoolName <String>]
[-Tags <Hashtable>]
[-PartnerDatabaseName <String>]
[-AllowConnections <AllowConnections>]
[-AsJob]
[-LicenseType <String>]
[-BackupStorageRedundancy <String>]
[-SecondaryType <String>]
[-HighAvailabilityReplicaCount <Int32>]
[-ZoneRedundant]
[-AssignIdentity]
[-EncryptionProtector <String>]
[-UserAssignedIdentityId <String[]>]
[-KeyList <String[]>]
[-FederatedClientId <Guid>]
[-EncryptionProtectorAutoRotation]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
VcoreBasedDatabase
New-AzSqlDatabaseSecondary
[-DatabaseName] <String>
[-ServerName] <String>
[-ResourceGroupName] <String>
-PartnerResourceGroupName <String>
-PartnerServerName <String>
-SecondaryComputeGeneration <String>
-SecondaryVCore <Int32>
[-Tags <Hashtable>]
[-PartnerDatabaseName <String>]
[-AllowConnections <AllowConnections>]
[-AsJob]
[-SecondaryComputeModel <String>]
[-LicenseType <String>]
[-AutoPauseDelayInMinutes <Int32>]
[-MinimumCapacity <Double>]
[-BackupStorageRedundancy <String>]
[-SecondaryType <String>]
[-HighAvailabilityReplicaCount <Int32>]
[-ZoneRedundant]
[-AssignIdentity]
[-EncryptionProtector <String>]
[-UserAssignedIdentityId <String[]>]
[-KeyList <String[]>]
[-FederatedClientId <Guid>]
[-EncryptionProtectorAutoRotation]
[-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
-AllowConnections
Specifies the read intent of the secondary Azure SQL Database. The acceptable values for this parameter are:
- No
- All
Parameter properties
| Type: | AllowConnections |
| Default value: | None |
| Accepted values: | No, All |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-AsJob
Run cmdlet in the background
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-AssignIdentity
Generate and assign a Microsoft Entra identity for this database for use with key management services like Azure KeyVault.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-AutoPauseDelayInMinutes
The auto pause delay in minutes for database(serverless only), -1 to opt out
Parameter properties
| Type: | Int32 |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-BackupStorageRedundancy
The Backup storage redundancy used to store backups for the SQL Database. Options are: Local, Zone and Geo.
Parameter properties
| Type: | String |
| Default value: | None |
| Accepted values: | Local, Zone, Geo, GeoZone |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Confirm
Prompts you for confirmation before running the cmdlet.
Parameter properties
| Type: | SwitchParameter |
| Default value: | False |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | cf |
Parameter sets
-DatabaseName
Specifies the name of the database to act as primary.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
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
-EncryptionProtector
The encryption protector key for SQL Database copy.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-EncryptionProtectorAutoRotation
The AKV Key Auto Rotation status
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-FederatedClientId
The federated client id for the SQL Database. It is used for cross tenant CMK scenario.
Parameter properties
| Type: | |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-HighAvailabilityReplicaCount
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.
Parameter properties
| Type: | Int32 |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-KeyList
The list of AKV keys for the SQL Database copy.
Parameter properties
| Type: | String[] |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-LicenseType
The license type for the Azure Sql database.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-MinimumCapacity
The Minimal capacity that the secondary database will always have allocated, if not paused. For serverless Azure Sql databases only.
Parameter properties
| Type: | Double |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | MinVCore, MinCapacity |
Parameter sets
-PartnerDatabaseName
The name of the secondary database to create.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-PartnerResourceGroupName
Specifies the name of the Azure Resource Group to which this cmdlet assigns the secondary database.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-PartnerServerName
Specifies the name of the Azure SQL database server to act as secondary.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-PartnerSubscriptionId
Specifies the subscription of the Azure SQL database server if it is different from the source.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-ResourceGroupName
Specifies the name of the Azure Resource Group to which this cmdlet assigns the primary database.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-SecondaryComputeGeneration
The compute generation of the Azure Sql Database secondary.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | Family |
Parameter sets
-SecondaryComputeModel
The compute model for Azure Sql database secondary. Serverless or Provisioned
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-SecondaryElasticPoolName
Specifies the name of the elastic pool in which to put the secondary database.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-SecondaryServiceObjectiveName
Specifies the name of the service objective to assign to the secondary database.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-SecondaryType
The secondary type of the database if it is a secondary. Valid values are Geo, Named and Standby.
Parameter properties
| Type: | String |
| Default value: | None |
| Accepted values: | Named, Geo, Standby |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-SecondaryVCore
The Vcore numbers of the Azure Sql Database secondary.
Parameter properties
| Type: | Int32 |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | Capacity |
Parameter sets
-ServerName
Specifies the name of the SQL Server of the primary SQL Database.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-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"}
Parameter properties
| Type: | Hashtable |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | Tag |
Parameter sets
-UserAssignedIdentityId
The list of user assigned identity for the SQL Database copy.
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: | False |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | wi |
Parameter sets
-ZoneRedundant
The zone redundancy to associate with the Azure Sql Database. This property is only settable for Hyperscale edition databases.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
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
String
Outputs
AzureReplicationLinkModel
Related Links
Azure PowerShell
Feedback
Was this page helpful?
