你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
New-AzSqlDatabaseSecondary
Creates a secondary database for an existing database and starts data replication.
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>]
[-ZoneRedundant]
[-AssignIdentity]
[-EncryptionProtector <String>]
[-UserAssignedIdentityId <String[]>]
[-KeyList <String[]>]
[-FederatedClientId <Guid>]
[-EncryptionProtectorAutoRotation]
[-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>
[-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]
[-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
-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 |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-AsJob
Run cmdlet in the background
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-AssignIdentity
Generate and assign a Microsoft Entra identity for this database for use with key management services like Azure KeyVault.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-AutoPauseDelayInMinutes
The auto pause delay in minutes for database(serverless only), -1 to opt out
Type: | Int32 |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-BackupStorageRedundancy
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, GeoZone |
Position: | Named |
Default value: | None |
Required: | False |
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 |
Required: | 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 |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with azure
Type: | IAzureContextContainer |
Aliases: | AzContext, AzureRmContext, AzureCredential |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-EncryptionProtector
The encryption protector key for SQL Database copy.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-EncryptionProtectorAutoRotation
The AKV Key Auto Rotation status
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-FederatedClientId
The federated client id for the SQL Database. It is used for cross tenant CMK scenario.
Type: | Nullable<T>[Guid] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-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.
Type: | Int32 |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-KeyList
The list of AKV keys for the SQL Database copy.
Type: | String[] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-LicenseType
The license type for the Azure Sql database.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-MinimumCapacity
The Minimal capacity that the secondary database will always have allocated, if not paused. For serverless Azure Sql databases only.
Type: | Double |
Aliases: | MinVCore, MinCapacity |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-PartnerDatabaseName
The name of the secondary database to create.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
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 |
Required: | True |
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 |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-PartnerSubscriptionId
Specifies the subscription of the Azure SQL database server if it is different from the source.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
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 |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-SecondaryComputeGeneration
The compute generation of the Azure Sql Database secondary.
Type: | String |
Aliases: | Family |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-SecondaryComputeModel
The compute model for Azure Sql database secondary. Serverless or Provisioned
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
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 |
Required: | False |
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 |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-SecondaryType
The secondary type of the database if it is a secondary. Valid values are Geo, Named and Standby.
Type: | String |
Accepted values: | Named, Geo, Standby |
Position: | Named |
Default value: | None |
Required: | False |
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 |
Required: | True |
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 |
Required: | True |
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 |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-UserAssignedIdentityId
The list of user assigned identity for the SQL Database copy.
Type: | String[] |
Position: | Named |
Default value: | None |
Required: | False |
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 |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ZoneRedundant
The zone redundancy to associate with the Azure Sql Database. This property is only settable for Hyperscale edition databases.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |