-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Added Deleted server command and modified new and set logical server #29017
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Added Deleted server command and modified new and set logical server #29017
Conversation
| Thanks for your contribution! The pull request validation has started. Please revisit this comment for updated status. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request adds a new Get-AzSqlDeletedServer cmdlet and modifies the soft-delete retention functionality in Azure SQL Server cmdlets. The changes improve the soft-delete feature's usability by simplifying the parameter model and providing better tooling for managing deleted servers.
Key Changes:
- Added new
Get-AzSqlDeletedServercmdlet to retrieve information about soft-deleted Azure SQL servers by location - Simplified soft-delete retention configuration by making
SoftDeleteRetentionDaysthe primary parameter (deprecatedEnableSoftDelete) - Reduced maximum retention period from 35 days to 7 days (breaking change)
Reviewed changes
Copilot reviewed 21 out of 24 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Sql/Sql/help/Get-AzSqlDeletedServer.md | New help documentation for Get-AzSqlDeletedServer cmdlet |
| src/Sql/Sql/help/Set-AzSqlServer.md | Updated examples to use SoftDeleteRetentionDays parameter instead of EnableSoftDelete |
| src/Sql/Sql/help/Restore-AzSqlServer.md | Clarified parameter descriptions for resource group and location requirements |
| src/Sql/Sql/help/New-AzSqlServer.md | Updated examples and parameter help to reflect new retention range (0-7 days) |
| src/Sql/Sql/Server/Services/AzureSqlDeletedServerCommunicator.cs | New service communicator for deleted server REST endpoints |
| src/Sql/Sql/Server/Services/AzureSqlDeletedServerAdapter.cs | New adapter layer for deleted server operations with model conversion |
| src/Sql/Sql/Server/Model/AzureSqlDeletedServerModel.cs | New model class representing deleted server properties |
| src/Sql/Sql/Server/Cmdlet/SetAzureSqlServer.cs | Refactored to use centralized soft-delete validation and computation methods |
| src/Sql/Sql/Server/Cmdlet/RestoreAzureSqlServer.cs | Enhanced validation logic for deleted server restoration with improved error messages |
| src/Sql/Sql/Server/Cmdlet/NewAzureSqlServer.cs | Refactored to use centralized soft-delete validation and added deprecation warning |
| src/Sql/Sql/Server/Cmdlet/GetAzSqlDeletedServer.cs | New cmdlet implementation for retrieving deleted servers |
| src/Sql/Sql/Server/Cmdlet/AzureSqlServerCmdletBase.cs | Added shared validation and computation methods for soft-delete parameters |
| src/Sql/Sql/Server/Cmdlet/AzureSqlDeletedServerCmdletBase.cs | New base class for deleted server cmdlets |
| src/Sql/Sql/Properties/Resources.resx | Added new error message strings for deleted server operations |
| src/Sql/Sql/Properties/Resources.Designer.cs | Generated code for new resource strings |
| src/Sql/Sql/ChangeLog.md | Added release notes documenting new cmdlet and breaking changes |
| src/Sql/Sql/Az.Sql.psd1 | Added Get-AzSqlDeletedServer to exported cmdlets list |
| src/Sql/Sql.Test/UnitTests/AzureSqlDeletedServerAttributeTests.cs | New unit tests for cmdlet attributes |
| src/Sql/Sql.Test/SessionRecords/Microsoft.Azure.Commands.Sql.Test.ScenarioTests.DeletedServerTests/TestGetDeletedServerByLocation.json | Test recording for deleted server retrieval |
| src/Sql/Sql.Test/ScenarioTests/ServerCrudTests.ps1 | Updated test cases to use SoftDeleteRetentionDays parameter |
| src/Sql/Sql.Test/ScenarioTests/DeletedServerTests.ps1 | New scenario tests for Get-AzSqlDeletedServer cmdlet |
| src/Sql/Sql.Test/ScenarioTests/DeletedServerTests.cs | New test runner class for deleted server tests |
Files not reviewed (1)
- src/Sql/Sql/Properties/Resources.Designer.cs: Language not supported
| string errorMessage = errEx.Body?.Error?.Message ?? errEx.Message; | ||
|
|
||
| if (errorCode == "ResourceGroupNotFound" || | ||
| (errorMessage.Contains("Resource group") && errorMessage.Contains("could not be found"))) |
Copilot
AI
Dec 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error handling checks both errorCode and errorMessage to determine ResourceGroupNotFound condition. However, the string matching in errorMessage ("Resource group" and "could not be found") is fragile and could break if Microsoft changes the error message text. Consider relying primarily on the errorCode when available, or use a more robust error detection mechanism.
| string errorMessage = errEx.Body?.Error?.Message ?? errEx.Message; | |
| if (errorCode == "ResourceGroupNotFound" || | |
| (errorMessage.Contains("Resource group") && errorMessage.Contains("could not be found"))) | |
| if (string.Equals(errorCode, "ResourceGroupNotFound", StringComparison.OrdinalIgnoreCase)) |
| /// Gets or sets the name of the deleted server to retrieve. If not specified, lists all deleted servers in the location. | ||
| /// </summary> | ||
| [Parameter(Mandatory = false, | ||
| ValueFromPipelineByPropertyName = true, | ||
| Position = 0, | ||
| HelpMessage = "The name of the deleted server to retrieve. If not specified, lists all deleted servers in the location.")] | ||
| [ValidateNotNullOrEmpty] | ||
| public string ServerName { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the location where the deleted server was located | ||
| /// </summary> | ||
| [Parameter(Mandatory = true, | ||
| ValueFromPipelineByPropertyName = true, | ||
| Position = 1, | ||
| HelpMessage = "The Azure region where the deleted server was located.")] | ||
| [LocationCompleter("Microsoft.Sql/deletedServers")] | ||
| [ValidateNotNullOrEmpty] | ||
| public string Location { get; set; } |
Copilot
AI
Dec 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Position attribute for Location parameter is set to 0, but for ServerName it's set to 1. However, in the parameter definition, ServerName comes before Location. The positions should match the natural order or the intended usage pattern. Consider making Location Position 1 and ServerName Position 0, or adjust them to match the expected command usage pattern.
| /// Gets or sets the name of the deleted server to retrieve. If not specified, lists all deleted servers in the location. | |
| /// </summary> | |
| [Parameter(Mandatory = false, | |
| ValueFromPipelineByPropertyName = true, | |
| Position = 0, | |
| HelpMessage = "The name of the deleted server to retrieve. If not specified, lists all deleted servers in the location.")] | |
| [ValidateNotNullOrEmpty] | |
| public string ServerName { get; set; } | |
| /// <summary> | |
| /// Gets or sets the location where the deleted server was located | |
| /// </summary> | |
| [Parameter(Mandatory = true, | |
| ValueFromPipelineByPropertyName = true, | |
| Position = 1, | |
| HelpMessage = "The Azure region where the deleted server was located.")] | |
| [LocationCompleter("Microsoft.Sql/deletedServers")] | |
| [ValidateNotNullOrEmpty] | |
| public string Location { get; set; } | |
| /// Gets or sets the location where the deleted server was located | |
| /// </summary> | |
| [Parameter(Mandatory = true, | |
| ValueFromPipelineByPropertyName = true, | |
| Position = 0, | |
| HelpMessage = "The Azure region where the deleted server was located.")] | |
| [LocationCompleter("Microsoft.Sql/deletedServers")] | |
| [ValidateNotNullOrEmpty] | |
| public string Location { get; set; } | |
| /// <summary> | |
| /// Gets or sets the name of the deleted server to retrieve. If not specified, lists all deleted servers in the location. | |
| /// </summary> | |
| [Parameter(Mandatory = false, | |
| ValueFromPipelineByPropertyName = true, | |
| Position = 1, | |
| HelpMessage = "The name of the deleted server to retrieve. If not specified, lists all deleted servers in the location.")] | |
| [ValidateNotNullOrEmpty] | |
| public string ServerName { get; set; } |
| string[] segments = deletedServer.OriginalId.Split('/'); | ||
|
|
||
| // Parse servername and subscription from originalId if available | ||
| string parsedServerName = segments[8]; | ||
| string parsedSubscriptionId = segments[2]; | ||
| string parsedResourceGroupName = segments[4]; | ||
|
|
Copilot
AI
Dec 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hardcoded array indices (2, 4, 8) are used to parse the resource ID without validation. If the OriginalId format changes or is malformed, this will throw an IndexOutOfRangeException. Consider using a more robust parsing method or at least validating the array length before accessing indices.
| string[] segments = deletedServer.OriginalId.Split('/'); | |
| // Parse servername and subscription from originalId if available | |
| string parsedServerName = segments[8]; | |
| string parsedSubscriptionId = segments[2]; | |
| string parsedResourceGroupName = segments[4]; | |
| string parsedServerName = null; | |
| string parsedSubscriptionId = null; | |
| string parsedResourceGroupName = null; | |
| if (!string.IsNullOrEmpty(deletedServer.OriginalId)) | |
| { | |
| string[] segments = deletedServer.OriginalId.Split('/'); | |
| // Parse server name, subscription, and resource group from OriginalId if available | |
| if (segments.Length > 8) | |
| { | |
| parsedSubscriptionId = segments[2]; | |
| parsedResourceGroupName = segments[4]; | |
| parsedServerName = segments[8]; | |
| } | |
| } |
| ### -SoftDeleteRetentionDays | ||
| Specifies the soft-delete retention days for the server. The acceptable values for this parameter are 0-35. Specify 0 to disable the SoftDelete | ||
| Specifies the soft-delete retention days for the server. The acceptable values for this parameter are 0-7. Specify 0 to disable the SoftDelete |
Copilot
AI
Dec 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The acceptable values range has been changed from 0-35 to 0-7, which is a breaking change for existing users who may have configured retention between 8-35 days. This breaking change should be clearly documented in the ChangeLog with proper migration guidance.
| Specifies the soft-delete retention days for the server. The acceptable values for this parameter are 0-7. Specify 0 to disable the SoftDelete | |
| Specifies the number of days that deleted databases are retained for recovery on this server. The acceptable values for this parameter are 0 through 7. Specify 0 to disable soft-delete retention. Earlier versions of this cmdlet allowed values from 0 through 35, so existing scripts or configurations that use values between 8 and 35 must be updated to use a value between 0 and 7 to succeed. |
| - Additional information about change #1 | ||
| --> | ||
| ## Upcoming Release | ||
| * Added 'Get-AzSqlDeletedServer' cmdlet to retrieve soft deleted Azure SQL servers |
Copilot
AI
Dec 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to ChangeLog guidelines, avoid using special characters like backticks in ChangeLog entries as they can cause issues in PowerShell module manifests. Replace 'Get-AzSqlDeletedServer' with Get-AzSqlDeletedServer (without quotes) or use simple quotes.
| * Added 'Get-AzSqlDeletedServer' cmdlet to retrieve soft deleted Azure SQL servers | ||
| - Supports retrieving deleted servers by location or specific deleted server by name | ||
| * Preannounced breaking changes. Please refer to https://go.microsoft.com/fwlink/?linkid=2333229 | ||
| * The EnableSoftDelete parameter is deprecated from `New-AzSqlServer` and `Set-AzSqlServer` cmdlets and will be removed by May 2026. |
Copilot
AI
Dec 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ChangeLog entry mentions "The EnableSoftDelete parameter is deprecated" but does not specify which version it was deprecated from. According to ChangeLog guidelines for Azure PowerShell, entries should clearly communicate the change from the user's perspective. Consider rewording to: "Deprecated EnableSoftDelete parameter in New-AzSqlServer and Set-AzSqlServer cmdlets. Use SoftDeleteRetentionDays parameter instead. EnableSoftDelete will be removed in May 2026."
| ## Upcoming Release | ||
| * Added 'Get-AzSqlDeletedServer' cmdlet to retrieve soft deleted Azure SQL servers | ||
| - Supports retrieving deleted servers by location or specific deleted server by name | ||
| * Preannounced breaking changes. Please refer to https://go.microsoft.com/fwlink/?linkid=2333229 |
Copilot
AI
Dec 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ChangeLog entry about breaking changes lacks detail for users. Consider expanding it to explain what the breaking changes are (e.g., SoftDeleteRetentionDays range reduced from 0-35 to 0-7, EnableSoftDelete parameter deprecated). Users should understand the impact without needing to click the link.
| [ValidateRange(0, 35)] | ||
| public int? SoftDeleteRetentionDays { get; set; } | ||
| HelpMessage = "Specifies the number of days to retain a deleted server for possible restoration. Valid values are 0-7. A value of 0 disables soft-delete retention.")] | ||
| public int? SoftDeleteRetentionDays { get; set; } |
Copilot
AI
Dec 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ValidateRange attribute has been removed from the SoftDeleteRetentionDays parameter. While validation logic exists in ValidateSoftDeleteParameters method, removing the ValidateRange attribute means users won't get immediate parameter validation feedback before the cmdlet executes. Consider keeping the ValidateRange attribute for better user experience.
| public int? SoftDeleteRetentionDays { get; set; } | |
| [ValidateRange(0, 7)] | |
| public int? SoftDeleteRetentionDays { get; set; } |
src/Sql/Sql/Az.Sql.psd1
Outdated
| 'Get-AzSqlDeletedServer', | ||
| 'Get-AzSqlElasticJob', |
Copilot
AI
Dec 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is inconsistent indentation with tabs instead of spaces on lines 138-139. The rest of the file uses spaces. Maintain consistent indentation throughout the file.
| 'Get-AzSqlDeletedServer', | |
| 'Get-AzSqlElasticJob', | |
| 'Get-AzSqlDeletedServer', | |
| 'Get-AzSqlElasticJob', |
| * Added 'Get-AzSqlDeletedServer' cmdlet to retrieve soft deleted Azure SQL servers | ||
| - Supports retrieving deleted servers by location or specific deleted server by name | ||
| * Preannounced breaking changes. Please refer to https://go.microsoft.com/fwlink/?linkid=2333229 | ||
| * The EnableSoftDelete parameter is deprecated from `New-AzSqlServer` and `Set-AzSqlServer` cmdlets and will be removed by May 2026. |
Copilot
AI
Dec 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to ChangeLog guidelines, avoid using backticks around cmdlet names in ChangeLog entries. Replace New-AzSqlServer and Set-AzSqlServer with New-AzSqlServer and Set-AzSqlServer (without backticks) or use simple quotes.
e2d36c5 to
0f45c7d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 22 out of 28 changed files in this pull request and generated 8 comments.
Files not reviewed (1)
- src/Sql/Sql/Properties/Resources.Designer.cs: Language not supported
| protected void ValidateSoftDeleteParameters(int? softDeleteRetentionDays, bool? enableSoftDelete) | ||
| { | ||
| // Validate SoftDeleteRetentionDays range | ||
| if (softDeleteRetentionDays.HasValue) | ||
| { | ||
| if (softDeleteRetentionDays.Value < SoftDeleteRetentionDaysDisabled || softDeleteRetentionDays.Value > SoftDeleteRetentionDaysMaximum) | ||
| { | ||
| throw new PSArgumentException($"SoftDeleteRetentionDays must be between {SoftDeleteRetentionDaysDisabled} and {SoftDeleteRetentionDaysMaximum}.", "SoftDeleteRetentionDays"); | ||
| } | ||
| } | ||
|
|
||
| // If both EnableSoftDelete and SoftDeleteRetentionDays are specified, validate their combination | ||
| if (enableSoftDelete.HasValue && softDeleteRetentionDays.HasValue) | ||
| { | ||
| if (enableSoftDelete == true && (softDeleteRetentionDays.Value < SoftDeleteRetentionDaysMinimum || softDeleteRetentionDays.Value > SoftDeleteRetentionDaysMaximum)) | ||
| { | ||
| throw new PSArgumentException($"When EnableSoftDelete is true, SoftDeleteRetentionDays must be between {SoftDeleteRetentionDaysMinimum} and {SoftDeleteRetentionDaysMaximum}.", "SoftDeleteRetentionDays"); | ||
| } | ||
| else if (enableSoftDelete == false && softDeleteRetentionDays.Value != SoftDeleteRetentionDaysDisabled) | ||
| { | ||
| throw new PSArgumentException($"When EnableSoftDelete is false, SoftDeleteRetentionDays must be {SoftDeleteRetentionDaysDisabled}.", "SoftDeleteRetentionDays"); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Computes the SoftDeleteRetentionDays value based on provided parameters | ||
| /// </summary> | ||
| /// <param name="softDeleteRetentionDays">The explicitly provided retention days</param> | ||
| /// <param name="enableSoftDelete">The enable soft delete flag</param> | ||
| /// <param name="existingValue">The existing retention days value (for Set operations)</param> | ||
| /// <returns>The computed retention days value</returns> | ||
| protected int? ComputeSoftDeleteRetentionDays(int? softDeleteRetentionDays, bool? enableSoftDelete, int? existingValue = null) | ||
| { | ||
| if (softDeleteRetentionDays.HasValue) | ||
| { | ||
| // SoftDeleteRetentionDays was explicitly provided, use it | ||
| return softDeleteRetentionDays.Value; | ||
| } | ||
| else if (enableSoftDelete.HasValue) | ||
| { | ||
| // Only EnableSoftDelete was provided | ||
| if (enableSoftDelete == true) | ||
| { | ||
| // Enabling soft-delete without specifying days, default to 7 | ||
| return SoftDeleteRetentionDaysMaximum; | ||
| } | ||
| else | ||
| { | ||
| // Disabling soft-delete, set to 0 | ||
| return SoftDeleteRetentionDaysDisabled; | ||
| } | ||
| } | ||
| else | ||
| { | ||
| // Neither parameter specified, return existing value or null | ||
| return existingValue; | ||
| } | ||
| } |
Copilot
AI
Jan 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no test coverage for the new validation logic that enforces SoftDeleteRetentionDays must be between 0 and 7. Consider adding negative test cases that verify:
- Values less than 0 are rejected with the appropriate error message
- Values greater than 7 are rejected with the appropriate error message
- The validation properly handles the interaction between EnableSoftDelete and SoftDeleteRetentionDays parameters
| AzureSqlDeletedServerModel model = new AzureSqlDeletedServerModel() | ||
| { | ||
| ServerName = parsedServerName, | ||
| DeletionTime = deletedServer.DeletionTime, | ||
| FullyQualifiedDomainName = deletedServer.FullyQualifiedDomainName, | ||
| Version = deletedServer.Version, | ||
| Id = deletedServer.Id, | ||
| Type = deletedServer.Type, | ||
| OriginalId = deletedServer.OriginalId, | ||
| SubscriptionId = parsedSubscriptionId, | ||
| ResourceGroupName = parsedResourceGroupName | ||
| }; |
Copilot
AI
Jan 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Location property is missing from the AzureSqlDeletedServerModel but is shown in the help documentation examples (lines 33, 53). The cmdlet receives Location as a parameter but doesn't populate it in the returned model. Either add a Location property to the model and populate it in CreateDeletedServerModelFromResponse, or update the help documentation to remove Location from the example outputs.
| private AzureSqlDeletedServerModel GetDeletedServerInResourceGroup() | ||
| { | ||
| DeletedServer deletedServer; | ||
| try | ||
| { | ||
| deletedServer = DeletedServerAdapter.GetDeletedServer(this.Location, this.ServerName); | ||
| } | ||
| catch (ErrorResponseException errEx) when (errEx.Response?.StatusCode == System.Net.HttpStatusCode.NotFound) | ||
| { | ||
| throw new PSArgumentException( | ||
| string.Format(Properties.Resources.DeletedServerNotFound, this.ServerName, this.Location), | ||
| "ServerName"); | ||
| } | ||
|
|
||
| AzureSqlDeletedServerModel deletedServerModel = DeletedServerAdapter.CreateDeletedServerModelFromResponse(deletedServer); | ||
|
|
||
| if (deletedServerModel == null) | ||
| { | ||
| throw new PSArgumentException( | ||
| string.Format(Properties.Resources.DeletedServerNotFound, this.ServerName, this.Location), | ||
| "ServerName"); | ||
| } | ||
|
|
||
| // Validate that the user-provided ResourceGroupName matches the deleted server's ResourceGroupName | ||
| if (!string.Equals(this.ResourceGroupName, deletedServerModel.ResourceGroupName, StringComparison.OrdinalIgnoreCase)) | ||
| { | ||
| throw new PSArgumentException( | ||
| string.Format(Properties.Resources.ResourceGroupMismatchForRestore, | ||
| this.ResourceGroupName, deletedServerModel.ResourceGroupName, this.ServerName), | ||
| "ResourceGroupName"); | ||
| } | ||
|
|
||
| return deletedServerModel; | ||
| } |
Copilot
AI
Jan 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no test coverage for the new error handling scenarios in RestoreAzureSqlServer:
- ResourceGroupMismatchForRestore error when user-provided resource group doesn't match the deleted server's original resource group
- ResourceGroupNotFoundForRestore error when the resource group doesn't exist
These are important error paths that should be tested to ensure users get clear, actionable error messages.
| /// </summary> | ||
| [Parameter(Mandatory = false, | ||
| HelpMessage = "Specify whether to enable soft-delete retention for the server. When enabled, a dropped server can be restored within the retention window (defaults to 7 days if not specified). To set a custom retention period use -SoftDeleteRetentionDays.")] | ||
| HelpMessage = "Specify whether to enable soft-delete retention for the server. When enabled, a dropped server can be restored within the retention window (defaults to 7 days if not specified).")] |
Copilot
AI
Jan 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The help message still references the EnableSoftDelete parameter in its description: "When enabled, a dropped server can be restored within the retention window (defaults to 7 days if not specified)." However, the parameter is deprecated and users are encouraged to use SoftDeleteRetentionDays instead. The help message should be updated to clarify that this parameter is deprecated and direct users to use SoftDeleteRetentionDays parameter instead.
| HelpMessage = "Specify whether to enable soft-delete retention for the server. When enabled, a dropped server can be restored within the retention window (defaults to 7 days if not specified).")] | |
| HelpMessage = "Deprecated. Use the SoftDeleteRetentionDays parameter instead to configure soft-delete retention. Setting SoftDeleteRetentionDays to 1-7 enables soft-delete, and setting it to 0 disables soft-delete.")] |
| /// Boolean Value for enabling Soft Delete Retention for server | ||
| /// </summary> | ||
| [Parameter(Mandatory = false, | ||
| HelpMessage = "Specify whether to enable soft-delete retention for the server. When enabled, a dropped server can be restored within the retention window (defaults to 7 days if not specified). To set a custom retention period use -SoftDeleteRetentionDays.")] |
Copilot
AI
Jan 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The help message still references the EnableSoftDelete parameter in its description: "When enabled, a dropped server can be restored within the retention window (defaults to 7 days if not specified). To set a custom retention period use -SoftDeleteRetentionDays." However, the parameter is deprecated and users are encouraged to use SoftDeleteRetentionDays instead. The help message should be updated to clarify that this parameter is deprecated and direct users to use SoftDeleteRetentionDays parameter instead.
| HelpMessage = "Specify whether to enable soft-delete retention for the server. When enabled, a dropped server can be restored within the retention window (defaults to 7 days if not specified). To set a custom retention period use -SoftDeleteRetentionDays.")] | |
| HelpMessage = "DEPRECATED. This parameter will be removed in a future release. Use SoftDeleteRetentionDays instead. Setting SoftDeleteRetentionDays to 1-7 enables soft-delete retention (a dropped server can be restored within the retention window), and setting it to 0 disables soft-delete retention.")] |
| <data name="ResourceGroupMismatchForRestore" xml:space="preserve"> | ||
| <value>The specified resource group '{0}' does not match the deleted server's original resource group '{1}'. Server '{2}' must be restored to its original resource group.</value> | ||
| </data> | ||
| <data name="ResourceGroupNotFoundForRestore" xml:space="preserve"> | ||
| <value>Cannot restore deleted server '{0}' because resource group '{1}' does not exist. Please create the resource group before restoring the server.</value> | ||
| </data> |
Copilot
AI
Jan 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message ResourceGroupMismatchForRestore ends with a period, while ResourceGroupNotFoundForRestore also ends with a period. However, many other error messages in the file don't end with periods (e.g., DeletedServerNotFound, DeletedServerNotFoundInLocation). For consistency with the broader codebase, consider whether error messages should consistently end with periods or not.
| Assert-StartsWith ($server5.ServerName + ".") $server5.FullyQualifiedDomainName | ||
| Assert-AreEqual $server5.SoftDeleteRetentionDays 0 | ||
|
|
||
| # Scenario 6: Create server without either parameter (should default to 0 - disabled ot -1 until backend fix is deployed) |
Copilot
AI
Jan 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a typo in the comment. "ot" should be "or". The comment reads "should default to 0 - disabled ot -1" but should be "should default to 0 - disabled or -1".
| # Scenario 6: Create server without either parameter (should default to 0 - disabled ot -1 until backend fix is deployed) | |
| # Scenario 6: Create server without either parameter (should default to 0 - disabled or -1 until backend fix is deployed) |
Description
Mandatory 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.