Fix Restore-AzSqlDatabase HA replica count default - #30126
Fix Restore-AzSqlDatabase HA replica count default#30126Charan Uppuluri (charanuvs) wants to merge 1 commit into
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Thank you for your contribution Charan Uppuluri (@charanuvs)! We will review the pull request and get back to you soon. |
|
Charan Uppuluri (@charanuvs) please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
There was a problem hiding this comment.
🟡 Changes recommended
Expand “HA” as “high availability (HA)” on first use in the changelog.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Fixes Restore-AzSqlDatabase so omitted HA replica counts remain unspecified while explicit values are preserved.
Changes:
- Conditionally assigns the HA replica count.
- Adds tests for omitted, zero, and nonzero values.
- Updates the SQL changelog.
File summaries
| File | Summary |
|---|---|
src/Sql/Sql/Database Backup/Cmdlet/RestoreAzureRMSqlDatabase.cs |
Handles replica-count parameter binding correctly. |
src/Sql/Sql/ChangeLog.md |
Documents the behavior fix. |
src/Sql/Sql.Test/UnitTests/AzureSqlDatabaseBackupUnitTests.cs |
Adds regression coverage. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| --> | ||
| ## Upcoming Release | ||
| * Exposed the backup storage redundancy type in the output of `Get-AzSqlInstanceDatabaseLongTermRetentionBackup`. | ||
| * Fixed `Restore-AzSqlDatabase` to omit the HA replica count when the parameter is not specified. |
Description
Restore-AzSqlDatabasepreviously assigned the non-nullableHAReplicaCountparameter directly to the nullable request model property. When-HAReplicaCountwas omitted, PowerShell's defaultInt32value causedhighAvailabilityReplicaCount: 0to be serialized instead of leaving the property unspecified.This change:
HighAvailabilityReplicaCountonly when-HAReplicaCountis explicitly bound.-HAReplicaCount 0.Validation:
dotnet test src/Sql/Sql.Test/Sql.Test.csproj --no-restore --filter "FullyQualifiedName~Microsoft.Azure.Commands.Sql.Test.UnitTests"(58 total, 56 passed, 2 existing skips)dotnet msbuild build.proj /p:Scope=Sqldotnet msbuild build.proj /t:StaticAnalysis /p:Scope=SqlMandatory Checklist
Please choose the target release of Azure PowerShell. (⚠️ Target release is a different concept from API readiness. Please click below links for details.)
Check this box to confirm: I have read the Submitting Changes section of
CONTRIBUTING.mdand reviewed the following information:ChangeLog.mdfile(s) appropriatelysrc/{{SERVICE}}/{{SERVICE}}/ChangeLog.md.## Upcoming Releaseheader in the past tense.ChangeLog.mdif no new release is required, such as fixing test case only.