New-AzureRmSqlDatabaseSecondary
Creates a secondary database for an existing database and starts data replication.
Warning
The AzureRM PowerShell module has been officially deprecated as of February 29, 2024. Users are advised to migrate from AzureRM to the Az PowerShell module to ensure continued support and updates.
Although the AzureRM module may still function, it's no longer maintained or supported, placing any continued use at the user's discretion and risk. Please refer to our migration resources for guidance on transitioning to the Az module.
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 |
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 |
-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: | AzureRmContext, AzureCredential |
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 |
-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 |
-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 teh Azure Sql Database secondary.
Type: | String |
Aliases: | Family |
Position: | Named |
Default value: | None |
Required: | True |
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 |
-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 |
-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 |