diff --git a/src/Sql/Sql/ChangeLog.md b/src/Sql/Sql/ChangeLog.md index cd4c1c2f18de..c1bba8b7d3e1 100644 --- a/src/Sql/Sql/ChangeLog.md +++ b/src/Sql/Sql/ChangeLog.md @@ -18,6 +18,7 @@ - Additional information about change #1 --> ## Upcoming Release +* Added an optional parameter `HAReplicaCount` to `Restore-AzSqlDatabase` ## Version 4.2.0 * Added a parameter named `UseIdentity` for `Set-AzSqlServerAudit`, `Set-AzSqlDatabaseAudit`, `Set-AzSqlServerMSSupportAudit` diff --git a/src/Sql/Sql/Database Backup/Cmdlet/RestoreAzureRMSqlDatabase.cs b/src/Sql/Sql/Database Backup/Cmdlet/RestoreAzureRMSqlDatabase.cs index 9fe836eeca16..7901f9092690 100644 --- a/src/Sql/Sql/Database Backup/Cmdlet/RestoreAzureRMSqlDatabase.cs +++ b/src/Sql/Sql/Database Backup/Cmdlet/RestoreAzureRMSqlDatabase.cs @@ -280,6 +280,14 @@ public class RestoreAzureRmSqlDatabase "BasePrice")] public string LicenseType { get; set; } + /// + /// Gets or sets the HA Replica Count option. + /// + [Parameter(Mandatory = false, + HelpMessage = "The HA Replica Count used to store backups for the SQL Database. Options are: 0, 1, 2.")] + [ValidateRange(0, 2)] + public int HAReplicaCount { get; set; } + /// /// Gets or sets the database backup storage redundancy. /// @@ -382,6 +390,7 @@ protected override AzureSqlDatabaseModel GetEntity() RequestedBackupStorageRedundancy = BackupStorageRedundancy, Tags = TagsConversionHelper.CreateTagDictionary(Tag, validate: true), ZoneRedundant = this.IsParameterBound(p => p.ZoneRedundant) ? ZoneRedundant.ToBool() : (bool?)null, + HighAvailabilityReplicaCount = HAReplicaCount, }; if (ParameterSetName == FromPointInTimeBackupWithVcoreSetName || ParameterSetName == FromDeletedDatabaseBackupWithVcoreSetName || diff --git a/src/Sql/Sql/Database Backup/Services/AzureSqlDatabaseBackupAdapter.cs b/src/Sql/Sql/Database Backup/Services/AzureSqlDatabaseBackupAdapter.cs index 19fa4a5f35e9..47f2dff2e1ec 100644 --- a/src/Sql/Sql/Database Backup/Services/AzureSqlDatabaseBackupAdapter.cs +++ b/src/Sql/Sql/Database Backup/Services/AzureSqlDatabaseBackupAdapter.cs @@ -592,6 +592,7 @@ internal AzureSqlDatabaseModel RestoreDatabase(string resourceGroup, DateTime re Capacity = model.Capacity }, LicenseType = model.LicenseType, + HighAvailabilityReplicaCount = model.HighAvailabilityReplicaCount, RequestedBackupStorageRedundancy = model.RequestedBackupStorageRedundancy, ZoneRedundant = model.ZoneRedundant, Tags = model.Tags diff --git a/src/Sql/Sql/help/Restore-AzSqlDatabase.md b/src/Sql/Sql/help/Restore-AzSqlDatabase.md index 08637a757610..fd00cda7a264 100644 --- a/src/Sql/Sql/help/Restore-AzSqlDatabase.md +++ b/src/Sql/Sql/help/Restore-AzSqlDatabase.md @@ -17,7 +17,7 @@ Restores a SQL database. ``` Restore-AzSqlDatabase [-FromPointInTimeBackup] -PointInTime -ResourceId -ServerName -TargetDatabaseName [-Edition ] [-ServiceObjectiveName ] - [-ElasticPoolName ] [-AsJob] [-LicenseType ] [-BackupStorageRedundancy ] + [-ElasticPoolName ] [-AsJob] [-LicenseType ] [-HAReplicaCount ] [-BackupStorageRedundancy ] [-ZoneRedundant] [-Tag ] [-ResourceGroupName] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` @@ -26,7 +26,7 @@ Restore-AzSqlDatabase [-FromPointInTimeBackup] -PointInTime -Resource ``` Restore-AzSqlDatabase [-FromPointInTimeBackup] -PointInTime -ResourceId -ServerName -TargetDatabaseName -Edition [-AsJob] -ComputeGeneration - -VCore [-LicenseType ] [-BackupStorageRedundancy ] [-ZoneRedundant] [-Tag ] + -VCore [-LicenseType ] [-HAReplicaCount ] [-BackupStorageRedundancy ] [-ZoneRedundant] [-Tag ] [-ResourceGroupName] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` @@ -36,7 +36,7 @@ Restore-AzSqlDatabase [-FromPointInTimeBackup] -PointInTime -Resource Restore-AzSqlDatabase [-FromDeletedDatabaseBackup] [-PointInTime ] -DeletionDate -ResourceId -ServerName -TargetDatabaseName [-Edition ] [-ServiceObjectiveName ] [-ElasticPoolName ] [-AsJob] [-LicenseType ] - [-BackupStorageRedundancy ] [-ZoneRedundant] [-Tag ] [-ResourceGroupName] + [-HAReplicaCount ] [-BackupStorageRedundancy ] [-ZoneRedundant] [-Tag ] [-ResourceGroupName] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` @@ -44,7 +44,7 @@ Restore-AzSqlDatabase [-FromDeletedDatabaseBackup] [-PointInTime ] -De ``` Restore-AzSqlDatabase [-FromDeletedDatabaseBackup] [-PointInTime ] -DeletionDate -ResourceId -ServerName -TargetDatabaseName -Edition [-AsJob] - -ComputeGeneration -VCore [-LicenseType ] [-BackupStorageRedundancy ] + -ComputeGeneration -VCore [-LicenseType ] [-HAReplicaCount ] [-BackupStorageRedundancy ] [-ZoneRedundant] [-Tag ] [-ResourceGroupName] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` @@ -53,7 +53,7 @@ Restore-AzSqlDatabase [-FromDeletedDatabaseBackup] [-PointInTime ] -De ``` Restore-AzSqlDatabase [-FromGeoBackup] -ResourceId -ServerName -TargetDatabaseName [-Edition ] [-ServiceObjectiveName ] [-ElasticPoolName ] [-AsJob] - [-LicenseType ] [-BackupStorageRedundancy ] [-ZoneRedundant] [-Tag ] + [-LicenseType ] [-HAReplicaCount ] [-BackupStorageRedundancy ] [-ZoneRedundant] [-Tag ] [-ResourceGroupName] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` @@ -61,7 +61,7 @@ Restore-AzSqlDatabase [-FromGeoBackup] -ResourceId -ServerName ### FromGeoBackupWithVcore ``` Restore-AzSqlDatabase [-FromGeoBackup] -ResourceId -ServerName -TargetDatabaseName - -Edition [-AsJob] -ComputeGeneration -VCore [-LicenseType ] + -Edition [-AsJob] -ComputeGeneration -VCore [-LicenseType ] [-HAReplicaCount ] [-BackupStorageRedundancy ] [-ZoneRedundant] [-Tag ] [-ResourceGroupName] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` @@ -70,7 +70,7 @@ Restore-AzSqlDatabase [-FromGeoBackup] -ResourceId -ServerName ``` Restore-AzSqlDatabase [-FromLongTermRetentionBackup] -ResourceId -ServerName -TargetDatabaseName [-Edition ] [-ServiceObjectiveName ] [-ElasticPoolName ] - [-AsJob] [-LicenseType ] [-BackupStorageRedundancy ] [-ZoneRedundant] [-Tag ] + [-AsJob] [-LicenseType ] [-HAReplicaCount ] [-BackupStorageRedundancy ] [-ZoneRedundant] [-Tag ] [-ResourceGroupName] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` @@ -79,7 +79,7 @@ Restore-AzSqlDatabase [-FromLongTermRetentionBackup] -ResourceId -Serve ``` Restore-AzSqlDatabase [-FromLongTermRetentionBackup] -ResourceId -ServerName -TargetDatabaseName -Edition [-AsJob] -ComputeGeneration -VCore - [-LicenseType ] [-BackupStorageRedundancy ] [-ZoneRedundant] [-Tag ] + [-LicenseType ] [-HAReplicaCount ] [-BackupStorageRedundancy ] [-ZoneRedundant] [-Tag ] [-ResourceGroupName] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` @@ -329,6 +329,21 @@ Default value: None Accept pipeline input: False Accept wildcard characters: False ``` +### -HAReplicaCount +The high availability replica count to associate with the Azure Sql Database. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: +Accepted values: 0, 1, 2 + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` ### -LicenseType The license type for the Azure Sql database.