Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/Sql/Sql.Test/ScenarioTests/DatabaseReplicationTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,12 @@ function Test-CreateNamedSecondaryDatabase()

# Create Named Replica
$namedReplica = New-AzSqlDatabaseSecondary -ResourceGroupName $rg.ResourceGroupName -ServerName $server.ServerName -DatabaseName $hsDatabase.DatabaseName `
-PartnerResourceGroupName $rg.ResourceGroupName -PartnerServerName $server.ServerName -PartnerDatabaseName "secondary" -SecondaryType "Named"
-PartnerResourceGroupName $rg.ResourceGroupName -PartnerServerName $server.ServerName -PartnerDatabaseName "secondary" -SecondaryType "Named" `
-HighAvailabilityReplicaCount 2

$newDb = Get-AzSqlDatabase -ResourceGroupName $rg.ResourceGroupName -ServerName $server.ServerName -DatabaseName "secondary"
Assert-AreEqual "Named" $newDb.SecondaryType
Assert-AreEqual 2 $newDb.HighAvailabilityReplicaCount
}
finally
{
Expand Down

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/Sql/Sql/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
- Update Backup Storage Redundancy values for LTR backups
* Added CurrentBackupStorageRedundancy, RequestedBackupStorageRedundancy to `Get-AzSqlDatabase`, `New-AzSqlDatabase`, `Set-AzSqlDatabase`, `New-AzSqlDatabaseSecondary`, `Set-AzSqlDatabaseSecondary`, `New-AzSqlDatabaseCopy`
- Changed BackupStorageRedundancy value to CurrentBackupStorageRedundancy, RequestedBackupStorageRedundancy to reflect both the current value and what has been requested if a change was made
* Added HighAvailabilityReplicaCount to `New-AzSqlDatabaseSecondary`

## Version 2.17.1
* Added cmdlet output breaking change warnings to the following:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
using System.Management.Automation;
using System.Globalization;
using Microsoft.WindowsAzure.Commands.Common.CustomAttributes;
using Microsoft.WindowsAzure.Commands.Utilities.Common;
using System;

namespace Microsoft.Azure.Commands.Sql.Replication.Cmdlet
Expand Down Expand Up @@ -163,6 +164,13 @@ public class NewAzureSqlDatabaseSecondary : AzureSqlDatabaseSecondaryCmdletBase
[ValidateSet("Named", "Geo")]
public string SecondaryType { get; set; }

/// <summary>
/// Gets or sets the number of high availability readonly replicas for the Azure Sql database
/// </summary>
[Parameter(Mandatory = false,
HelpMessage = "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.")]
public int HighAvailabilityReplicaCount { get; set; }

protected static readonly string[] ListOfRegionsToShowWarningMessageForGeoBackupStorage = { "eastasia", "southeastasia", "brazilsouth", "east asia", "southeast asia", "brazil south" };

/// <summary>
Expand Down Expand Up @@ -242,6 +250,7 @@ protected override IEnumerable<AzureReplicationLinkModel> ApplyUserInputToModel(
LicenseType = LicenseType,
RequestedBackupStorageRedundancy = this.BackupStorageRedundancy,
SecondaryType = SecondaryType,
HighAvailabilityReplicaCount = this.IsParameterBound(p => p.HighAvailabilityReplicaCount) ? HighAvailabilityReplicaCount : (int?)null,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to convert null to int?

};

if(ParameterSetName == DtuDatabaseParameterSet)
Expand Down
7 changes: 6 additions & 1 deletion src/Sql/Sql/Replication/Model/AzureReplicationLinkModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,13 @@ public class AzureReplicationLinkModel : AzureSqlDatabaseReplicationModelBase
public string RequestedBackupStorageRedundancy { get; set; }

/// <summary>
/// Gets or sets the secondary type for the database if it is a secondary.
/// Gets or sets the secondary type for the database if it is a secondary
/// </summary>
public string SecondaryType { get; set; }

/// <summary>
/// Gets or sets the number of high availability replicas for the database
/// </summary>
public int? HighAvailabilityReplicaCount { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ internal AzureReplicationLinkModel CreateLinkWithNewSdk(string resourceGroupName
LicenseType = model.LicenseType,
RequestedBackupStorageRedundancy = model.RequestedBackupStorageRedundancy,
SecondaryType = model.SecondaryType,
HighAvailabilityReplicaCount = model.HighAvailabilityReplicaCount,
});

return GetLink(model.ResourceGroupName, model.ServerName, model.DatabaseName, model.PartnerResourceGroupName, model.PartnerServerName);
Expand Down
27 changes: 21 additions & 6 deletions src/Sql/Sql/help/New-AzSqlDatabaseSecondary.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ Creates a secondary database for an existing database and starts data replicatio
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>] [-ServerName] <String>
[-ResourceGroupName] <String> [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm]
[<CommonParameters>]
[-LicenseType <String>] [-BackupStorageRedundancy <String>] [-SecondaryType <String>]
[-HighAvailabilityReplicaCount <Int32>] [-ServerName] <String> [-ResourceGroupName] <String>
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

### VcoreBasedDatabase
```
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>] [-ServerName] <String>
[-ResourceGroupName] <String> [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm]
[<CommonParameters>]
[-BackupStorageRedundancy <String>] [-SecondaryType <String>] [-HighAvailabilityReplicaCount <Int32>]
[-ServerName] <String> [-ResourceGroupName] <String> [-DefaultProfile <IAzureContextContainer>] [-WhatIf]
[-Confirm] [<CommonParameters>]
```

## DESCRIPTION
Expand Down Expand Up @@ -134,6 +134,21 @@ 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.

```yaml
Type: System.Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -LicenseType
The license type for the Azure Sql database.

Expand Down