Skip to content

[Sql] Updated soft-delete test and added preview tag to cmdlets#29176

Open
rambabu-yalla wants to merge 3 commits intoAzure:mainfrom
rambabu-yalla:ramyal/UpdateTestCasesAndPreviewTag
Open

[Sql] Updated soft-delete test and added preview tag to cmdlets#29176
rambabu-yalla wants to merge 3 commits intoAzure:mainfrom
rambabu-yalla:ramyal/UpdateTestCasesAndPreviewTag

Conversation

@rambabu-yalla
Copy link
Contributor

@rambabu-yalla rambabu-yalla commented Feb 15, 2026

Description

  1. Updated a test case to verify retention days returned from API is -1 only.
  2. Updated preview tag for GetAzSqlDeletedServer command and RestoreAzSqlServer cmdlet.

Mandatory Checklist

  • SHOULD update ChangeLog.md file(s) appropriately
    • Update src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md.
      • A snippet outlining the change(s) made in the PR should be written under the ## Upcoming Release header in the past tense.
    • Should not change ChangeLog.md if no new release is required, such as fixing test case only.
  • SHOULD regenerate markdown help files if there is cmdlet API change. Instruction
  • SHOULD have proper test coverage for changes in pull request.
  • SHOULD NOT adjust version of module manually in pull request

Copilot AI review requested due to automatic review settings February 15, 2026 15:41
@azure-client-tools-bot-prd
Copy link

Thanks for your contribution! The pull request validation has started. Please revisit this comment for updated status.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates Azure SQL Server soft-delete preview signaling and tightens a scenario test expectation around the API-returned SoftDeleteRetentionDays value.

Changes:

  • Mark Get-AzSqlDeletedServer and Restore-AzSqlServer as preview via CmdletPreview.
  • Add "[Preview]" prefixes to soft-delete-related parameter help text in New-AzSqlServer / Set-AzSqlServer.
  • Update ServerCrudTests.ps1 to assert SoftDeleteRetentionDays is -1 (instead of 0 or -1) when no soft-delete parameters are provided.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/Sql/Sql/Server/Cmdlet/SetAzureSqlServer.cs Adds "[Preview]" labeling to soft-delete parameter help text.
src/Sql/Sql/Server/Cmdlet/RestoreAzureSqlServer.cs Adds CmdletPreview attribute for soft-delete preview signaling.
src/Sql/Sql/Server/Cmdlet/NewAzureSqlServer.cs Adds "[Preview]" labeling to soft-delete parameter help text.
src/Sql/Sql/Server/Cmdlet/GetAzSqlDeletedServer.cs Adds CmdletPreview attribute for soft-delete preview signaling.
src/Sql/Sql.Test/ScenarioTests/ServerCrudTests.ps1 Changes default/unset retention-days assertion to require -1.

/// <summary>
/// Defines the Restore-AzSqlServer cmdlet
/// </summary>
[CmdletPreview("Server soft-delete feature is currently in Public Preview")]
Copy link

Copilot AI Feb 15, 2026

Choose a reason for hiding this comment

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

Same as Get-AzSqlDeletedServer: marking Restore-AzSqlServer with CmdletPreview is a user-facing change. Consider documenting it under src/Sql/Sql/ChangeLog.md## Upcoming Release so consumers can see the preview status change in release notes.

Copilot uses AI. Check for mistakes.
/// </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 = "[Preview] 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.")]
Copy link

Copilot AI Feb 15, 2026

Choose a reason for hiding this comment

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

The HelpMessage is being tagged with a literal "[Preview]" prefix. In this repo preview signaling is typically done via the [CmdletPreview(...)] attribute (e.g., src/Sql/Sql/Database Backup/Cmdlet/SetAzureRmSqlDatabaseLongTermRetentionBackupLegalHold.cs:25, src/Network/Network/LoadBalancer/Probe/AddAzureRmLoadBalancerProbeConfigCommand.cs:27), which also produces a consistent preview warning experience. Consider adding CmdletPreview to New-AzSqlServer with messaging that only the soft-delete parameters are preview, and keep the parameter HelpMessage text free of the manual prefix (or otherwise align with the established approach).

Copilot uses AI. Check for mistakes.
/// </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).")]
HelpMessage = "[Preview] 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).")]
Copy link

Copilot AI Feb 15, 2026

Choose a reason for hiding this comment

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

Same as New-AzSqlServer: tagging parameters as preview by prefixing the HelpMessage with "[Preview]" is inconsistent with the repo’s established preview mechanism ([CmdletPreview(...)]). If soft-delete is preview, consider putting the preview warning on the cmdlet via CmdletPreview (with text noting which parameters/behavior are preview) rather than encoding preview state into the HelpMessage string.

Copilot uses AI. Check for mistakes.
Assert-AreEqual $server6.SqlAdministratorLogin $serverLogin
Assert-StartsWith ($server6.ServerName + ".") $server6.FullyQualifiedDomainName
Assert-True {$server6.SoftDeleteRetentionDays -eq 0 -or $server6.SoftDeleteRetentionDays -eq -1}
Assert-True {$server6.SoftDeleteRetentionDays -eq -1}
Copy link

Copilot AI Feb 15, 2026

Choose a reason for hiding this comment

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

This test now asserts the service returns SoftDeleteRetentionDays == -1 when neither -EnableSoftDelete nor -SoftDeleteRetentionDays are specified. That’s inconsistent with other scenarios in this same test that treat the disabled/default state as 0, and with cmdlet validation/constants that define the supported range as 0–7. If the backend ever returns 0 for the unset case (or varies by region/api-version), this will become flaky; consider either accepting both 0 and -1, or normalizing the API’s -1 to 0 in the adapter/model (and then assert the normalized value).

Suggested change
Assert-True {$server6.SoftDeleteRetentionDays -eq -1}
Assert-True { ($server6.SoftDeleteRetentionDays -eq -1) -or ($server6.SoftDeleteRetentionDays -eq 0) }

Copilot uses AI. Check for mistakes.
@rambabu-yalla rambabu-yalla changed the title Updated test and added preview tag [Sql] Updated soft-delete test and added preview tag to cmdlets Feb 15, 2026
@isra-fel
Copy link
Member

Hi @rambabu-yalla please join the Microsoft org on GitHub following this link https://aka.ms/AzureGitHub if you are a Microsoft Employee. It ensures all CI pipeline trigger automatically for you.

Copy link
Member

@isra-fel isra-fel left a comment

Choose a reason for hiding this comment

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

Please see my inline comments. Thank you

Copilot AI review requested due to automatic review settings February 19, 2026 17:19
Copy link
Contributor

Copilot AI left a 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 11 out of 11 changed files in this pull request and generated 1 comment.

- Additional information about change #1
-->
## Upcoming Release
* Added public preview tag for `EnableSoftDelete` and `SoftDeleteRetentionDays` properties in `New-AzSqlServer` and `Set-AzSqlServer` cmdlets
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

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

The term "properties" should be "parameters" in this context. EnableSoftDelete and SoftDeleteRetentionDays are cmdlet parameters (inputs that users provide to cmdlets), not properties. Looking at other ChangeLog entries (e.g., line 29, 33, 40), "parameters" is consistently used when referring to cmdlet inputs.

Suggested change
* Added public preview tag for `EnableSoftDelete` and `SoftDeleteRetentionDays` properties in `New-AzSqlServer` and `Set-AzSqlServer` cmdlets
* Added public preview tag for `EnableSoftDelete` and `SoftDeleteRetentionDays` parameters in `New-AzSqlServer` and `Set-AzSqlServer` cmdlets

Copilot uses AI. Check for mistakes.
@isra-fel
Copy link
Member

/azp run

@azure-pipelines
Copy link
Contributor

Azure Pipelines successfully started running 3 pipeline(s).

@rambabu-yalla
Copy link
Contributor Author

@isra-fel : Requested changes are in place . Could you please review and merge the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments