Skip to content

Conversation

rambabu-yalla
Copy link
Contributor

@rambabu-yalla rambabu-yalla commented Sep 28, 2025

… params

Description

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 Copilot AI review requested due to automatic review settings September 28, 2025 21:06
Copy link

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

Copy link
Contributor

@Copilot 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

This PR improves parameter validation for the EnableSoftDelete and SoftDeleteRetentionDays parameters in Azure SQL Server cmdlets. The changes enhance parameter consistency, validation logic, and error handling for soft delete functionality.

Key Changes

  • Enhanced validation logic for soft delete parameters with explicit null-value handling
  • Improved error messages and added range validation for retention days (1-35)
  • Updated parameter types and test cleanup procedures for better consistency

Reviewed Changes

Copilot reviewed 6 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
SetAzureSqlServer.cs Changed EnableSoftDelete to nullable bool and enhanced validation logic with explicit three-way branching
NewAzureSqlServer.cs Applied same parameter type change and validation improvements as SetAzureSqlServer
RestoreAzureSqlServer.cs Fixed error message to reference Location instead of ResourceGroupName for deleted server searches
Resources.resx Added new error messages for range validation and zero retention scenarios
Set-AzSqlServer.md Improved documentation clarity for soft delete retention behavior
ServerCrudTests.ps1 Updated test cleanup to use explicit EnableSoftDelete $False instead of setting retention days to 0
Files not reviewed (1)
  • src/Sql/Sql/Properties/Resources.Designer.cs: Language not supported

@rambabu-yalla rambabu-yalla force-pushed the dev/ramyal/fix_server-restore branch from e526311 to ee1b8a8 Compare September 28, 2025 21:51
Copy link
Contributor

@Copilot 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 7 out of 12 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • src/Sql/Sql/Properties/Resources.Designer.cs: Language not supported

@rambabu-yalla rambabu-yalla force-pushed the dev/ramyal/fix_server-restore branch from ee1b8a8 to 2514bc6 Compare September 28, 2025 22:02
Copy link
Contributor

@Copilot 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 7 out of 12 changed files in this pull request and generated 3 comments.

Files not reviewed (1)
  • src/Sql/Sql/Properties/Resources.Designer.cs: Language not supported

Copy link
Contributor

@Copilot 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 7 out of 12 changed files in this pull request and generated 2 comments.

Files not reviewed (1)
  • src/Sql/Sql/Properties/Resources.Designer.cs: Language not supported

@rambabu-yalla rambabu-yalla force-pushed the dev/ramyal/fix_server-restore branch from 2514bc6 to c041d24 Compare September 28, 2025 22:23
Copy link
Contributor

@Copilot 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 7 out of 12 changed files in this pull request and generated 4 comments.

Files not reviewed (1)
  • src/Sql/Sql/Properties/Resources.Designer.cs: Language not supported

updateData[0].KeyId = this.KeyId ?? updateData[0].KeyId;
updateData[0].FederatedClientId = this.FederatedClientId ?? updateData[0].FederatedClientId;
if (this.EnableSoftDelete)
if (this.EnableSoftDelete == true)
Copy link
Preview

Copilot AI Sep 28, 2025

Choose a reason for hiding this comment

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

Use direct boolean comparison instead of explicit comparison to true. This can be simplified to if (this.EnableSoftDelete == true) or better yet if (EnableSoftDelete.GetValueOrDefault()).

Suggested change
if (this.EnableSoftDelete == true)
if (this.EnableSoftDelete.GetValueOrDefault())

Copilot uses AI. Check for mistakes.

// If enabling soft-delete retention, use the explicitly provided value or default to 7 days if none provided.
updateData[0].SoftDeleteRetentionDays = this.SoftDeleteRetentionDays ?? 7;
}
else if (this.EnableSoftDelete == false)
Copy link
Preview

Copilot AI Sep 28, 2025

Choose a reason for hiding this comment

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

Use direct boolean comparison instead of explicit comparison to false. This can be simplified to if (EnableSoftDelete.GetValueOrDefault(true) == false) or use a more explicit nullable check pattern.

Suggested change
else if (this.EnableSoftDelete == false)
else if (this.EnableSoftDelete.GetValueOrDefault(true) == false)

Copilot uses AI. Check for mistakes.

Comment on lines +257 to +262
if (this.EnableSoftDelete == true)
{
// If enabling soft-delete retention, use the explicitly provided value or default to 7 days if none provided.
softDeleteRetentionDays = this.SoftDeleteRetentionDays ?? 7;
}
else if (this.EnableSoftDelete == false)
Copy link
Preview

Copilot AI Sep 28, 2025

Choose a reason for hiding this comment

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

Same as in SetAzureSqlServer.cs - use direct boolean comparison instead of explicit comparison to true/false for nullable boolean values.

Suggested change
if (this.EnableSoftDelete == true)
{
// If enabling soft-delete retention, use the explicitly provided value or default to 7 days if none provided.
softDeleteRetentionDays = this.SoftDeleteRetentionDays ?? 7;
}
else if (this.EnableSoftDelete == false)
if (this.EnableSoftDelete)
{
// If enabling soft-delete retention, use the explicitly provided value or default to 7 days if none provided.
softDeleteRetentionDays = this.SoftDeleteRetentionDays ?? 7;
}
else if (!this.EnableSoftDelete)

Copilot uses AI. Check for mistakes.

// If enabling soft-delete retention, use the explicitly provided value or default to 7 days if none provided.
softDeleteRetentionDays = this.SoftDeleteRetentionDays ?? 7;
}
else if (this.EnableSoftDelete == false)
Copy link
Preview

Copilot AI Sep 28, 2025

Choose a reason for hiding this comment

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

Same as in SetAzureSqlServer.cs - use direct boolean comparison instead of explicit comparison to true/false for nullable boolean values.

Suggested change
else if (this.EnableSoftDelete == false)
else if (this.EnableSoftDelete is false)

Copilot uses AI. Check for mistakes.

@VeryEarly VeryEarly self-assigned this Sep 29, 2025
@VeryEarly
Copy link
Collaborator

/azp run azure-powershell - security-tools

Copy link
Contributor

Azure Pipelines successfully started running 1 pipeline(s).

@VeryEarly VeryEarly merged commit 1b48e22 into Azure:main Sep 29, 2025
12 checks passed
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.

2 participants