Skip to content

Powershell STR cmdlet updates for PITR Immutability - #30215

Open
Akshay Nehe (invincible-akshay) wants to merge 4 commits into
Azure:mainfrom
invincible-akshay:dev/akshaynehe/str_api_powershell
Open

Akshay Nehe (invincible-akshay) wants to merge 4 commits into
Azure:mainfrom
invincible-akshay:dev/akshaynehe/str_api_powershell

Conversation

@invincible-akshay

@invincible-akshay Akshay Nehe (invincible-akshay) commented Sep 28, 2026 •

Copy link
Copy Markdown
Member

🤖 PR Validation — ❌ Action needed

Tests
❌ 58/64
️✔️Az.Accounts
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Az.Compute
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Az.EventHub
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Az.KeyVault
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Az.ManagedServiceIdentity
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Az.Monitor
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Az.Network
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Test
️✔️PowerShell Core - Linux
️✔️PowerShell Core - MacOS
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Az.OperationalInsights
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Az.PrivateDns
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
❌Az.Sql
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Breaking Change Check
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Signature Check
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Help Example Check
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Help File Existence Check
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️File Change Check
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️UX Metadata Check
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
❌Generated Sdk Check
❌PowerShell Core - Windows
Type Module Sdk Description Remediation
❌ Az.Sql src/Sql/Sql.Management.Sdk Generated code for Az.Sql is not up to date or you have updated generated Sdk. You may need to rebase on the latest main, regenerate code accroding to README.md file under src/Sql/Sql.Management.Sdk, and make sure no more updates based on generated files.
❌Windows PowerShell - Windows
Type Module Sdk Description Remediation
❌ Az.Sql src/Sql/Sql.Management.Sdk Generated code for Az.Sql is not up to date or you have updated generated Sdk. You may need to rebase on the latest main, regenerate code accroding to README.md file under src/Sql/Sql.Management.Sdk, and make sure no more updates based on generated files.
❌Test
❌PowerShell Core - Linux
❌PowerShell Core - MacOS
❌PowerShell Core - Windows
❌Windows PowerShell - Windows
️✔️Az.Storage
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Az.TrafficManager
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Breaking Change Check
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Signature Check
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Help Example Check
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Help File Existence Check
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️File Change Check
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️UX Metadata Check
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Generated Sdk Check
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Test
️✔️PowerShell Core - Linux
️✔️PowerShell Core - MacOS
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows

Description

Added short-term backup immutability support to Set-AzSqlDatabaseBackupShortTermRetentionPolicy and Set-AzSqlInstanceDatabaseBackupShortTermRetentionPolicy.
Added the LockImmutability parameter and ImmutabilityStatus output property.
Restricted LockImmutability to live Managed Instance databases.
Added an irreversible-action confirmation prompt when locking immutability, which can be bypassed with -Force.
Added an override for DiffBackupIntervalInHours datatype as an AutoRest directive to force int32 instead of double, related to Azure/typespec-azure#919

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 balanced review requested due to automatic review settings September 28, 2026 23:22
@azure-pipelines

Copy link
Copy Markdown
Contributor
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

The SQL Database cmdlet currently rejects valid lock-only updates unless another retention setting is supplied.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Adds point-in-time backup immutability support to Azure SQL Database and Managed Instance short-term retention cmdlets.

Changes:

  • Adds LockImmutability, Force, and ImmutabilityStatus.
  • Updates the SQL SDK to API version 2026-08-01-preview.
  • Adds help, changelog entries, and scenario coverage.
File Description
src/​Sql/​Sql/​ManagedDatabase Backup/​Services/​AzureSqlManagedDatabaseBackupAdapter.cs Forwards managed-database immutability settings.
src/​Sql/​Sql/​ManagedDatabase Backup/​Model/​AzureSqlManagedDatabaseBackupShortTermRetentionPolicyModel.cs Exposes immutability status.
src/​Sql/​Sql/​ManagedDatabase Backup/​Cmdlet/​SetAzureSqlManagedDatabaseBackupShortTermRetentionPolicy.cs Adds locking, validation, and confirmation.
src/​Sql/​Sql/​help/​Set-AzSqlInstanceDatabaseBackupShortTermRetentionPolicy.md Documents Managed Instance locking.
src/​Sql/​Sql/​help/​Set-AzSqlDatabaseBackupShortTermRetentionPolicy.md Documents SQL Database locking.
src/​Sql/​Sql/​help/​Get-AzSqlInstanceDatabaseBackupShortTermRetentionPolicy.md Documents Managed Instance status output.
src/​Sql/​Sql/​help/​Get-AzSqlDatabaseBackupShortTermRetentionPolicy.md Documents SQL Database status output.
src/​Sql/​Sql/​Database Backup/​Services/​AzureSqlDatabaseBackupAdapter.cs Forwards SQL Database lock settings.
src/​Sql/​Sql/​Database Backup/​Model/​AzureSqlDatabaseBackupShortTermRetentionPolicyModel.cs Adds immutability model properties.
src/​Sql/​Sql/​Database Backup/​Cmdlet/​SetAzureSqlDatabaseBackupShortTermRetentionPolicy.cs Adds locking and confirmation behavior.
src/​Sql/​Sql/​ChangeLog.md Records the user-facing feature.
src/​Sql/​Sql.Test/​ScenarioTests/​ManagedDatabaseBackupTests.ps1 Tests Managed Instance immutability.
src/​Sql/​Sql.Test/​ScenarioTests/​ManagedDatabaseBackupTests.cs Registers the Managed Instance scenario.
src/​Sql/​Sql.Test/​ScenarioTests/​DatabaseBackupTests.ps1 Tests SQL Database immutability.
src/​Sql/​Sql.Test/​ScenarioTests/​DatabaseBackupTests.cs Registers the SQL Database scenario.
src/​Sql/​Sql.Management.Sdk/​README.md Updates SDK inputs and type transformation.
src/​Sql/​Sql.Management.Sdk/​Generated/​Models/​ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesUpdateHeaders.cs Adds generated update headers.
src/​Sql/​Sql.Management.Sdk/​Generated/​Models/​ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCreateOrUpdateHeaders.cs Adds generated create/update headers.
src/​Sql/​Sql.Management.Sdk/​Generated/​Models/​ManagedBackupShortTermRetentionPolicyProperties.cs Adds managed immutability properties.
src/​Sql/​Sql.Management.Sdk/​Generated/​Models/​ManagedBackupShortTermRetentionPolicy.cs Updates the managed policy resource.
src/​Sql/​Sql.Management.Sdk/​Generated/​Models/​ManagedBackupShortTermRetentionPoliciesUpdateHeaders.cs Adds managed update headers.
src/​Sql/​Sql.Management.Sdk/​Generated/​Models/​ManagedBackupShortTermRetentionPoliciesCreateOrUpdateHeaders.cs Adds managed create/update headers.
src/​Sql/​Sql.Management.Sdk/​Generated/​Models/​ImmutabilityStatus.cs Defines generated status constants.
src/​Sql/​Sql.Management.Sdk/​Generated/​Models/​BackupShortTermRetentionPolicyProperties.cs Adds database immutability properties.
src/​Sql/​Sql.Management.Sdk/​Generated/​Models/​BackupShortTermRetentionPolicy.cs Updates the database policy resource.
src/​Sql/​Sql.Management.Sdk/​Generated/​Models/​BackupShortTermRetentionPoliciesUpdateHeaders.cs Adds database update headers.
src/​Sql/​Sql.Management.Sdk/​Generated/​Models/​BackupShortTermRetentionPoliciesCreateOrUpdateHeaders.cs Adds database create/update headers.
src/​Sql/​Sql.Management.Sdk/​Generated/​ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperationsExtensions.cs Regenerates dropped-database extensions.
src/​Sql/​Sql.Management.Sdk/​Generated/​ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations.cs Regenerates dropped-database operations.
src/​Sql/​Sql.Management.Sdk/​Generated/​ManagedBackupShortTermRetentionPoliciesOperationsExtensions.cs Regenerates managed policy extensions.
src/​Sql/​Sql.Management.Sdk/​Generated/​ManagedBackupShortTermRetentionPoliciesOperations.cs Regenerates managed policy operations.
src/​Sql/​Sql.Management.Sdk/​Generated/​IManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations.cs Updates dropped-policy SDK contracts.
src/​Sql/​Sql.Management.Sdk/​Generated/​IManagedBackupShortTermRetentionPoliciesOperations.cs Updates managed-policy SDK contracts.
src/​Sql/​Sql.Management.Sdk/​Generated/​IBackupShortTermRetentionPoliciesOperations.cs Updates database-policy SDK contracts.
src/​Sql/​Sql.Management.Sdk/​Generated/​BackupShortTermRetentionPoliciesOperationsExtensions.cs Regenerates database policy extensions.
src/​Sql/​Sql.Management.Sdk/​Generated/​BackupShortTermRetentionPoliciesOperations.cs Regenerates database policy operations.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Contributor
Azure Pipelines:
Successfully started running 3 pipeline(s).

Copilot AI balanced review requested due to automatic review settings October 8, 2026 03:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The irreversible locking workflow and preview API migration require human validation of service-rollout compatibility.

0 open findings

1 resolved since last review
Previously missed (1)

In code that hasn't changed since last review

Medium severity Preserve database identity and deletion date when returning adapter results

src/​Sql/​Sql/​ManagedDatabase Backup/​Cmdlet/​SetAzureSqlManagedDatabaseBackupShortTermRetentionPolicy.cs:187

Returning the adapter result changes the output for dropped databases: UpsertDeletedManagedDatabaseRetentionPolicy passes the combined databaseName,timestamp identifier to the model converter and omits deletionDate (AzureSqlManagedDatabaseBackupAdapter.cs:147-149). The returned DatabaseName therefore gains the timestamp suffix and DeletionDate becomes null. Previously, returning entity preserved both fields. Restore the original identity fields while retaining the service's updated policy values.

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Contributor
Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command.

NoriZC
NoriZC previously approved these changes Oct 8, 2026
Copilot AI balanced review requested due to automatic review settings October 8, 2026 04:31
@NoriZC

NoriZC commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

Copy link
Copy Markdown
Contributor
Azure Pipelines:
Successfully started running 3 pipeline(s).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Irreversible locking and broad preview-API regeneration require human validation beyond the mocked-only scenarios.

2 open findings

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Contributor
Azure Pipelines:
Successfully started running 3 pipeline(s).

Comment thread src/Sql/Sql.Test/ScenarioTests/DatabaseBackupTests.ps1 Outdated
Comment thread src/Sql/Sql.Test/ScenarioTests/DatabaseBackupTests.ps1
Comment thread src/Sql/Sql.Test/ScenarioTests/ManagedDatabaseBackupTests.ps1
Copilot AI balanced review requested due to automatic review settings October 9, 2026 08:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The broad generated SDK migration and irreversible locking behavior warrant final human validation.

2 open findings

🧠 Review effort: Balanced

@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Contributor
Azure Pipelines:
Successfully started running 3 pipeline(s).

@invincible-akshay
Akshay Nehe (invincible-akshay) force-pushed the dev/akshaynehe/str_api_powershell branch from 371c477 to 24e0bda Compare October 9, 2026 18:24
Copilot AI balanced review requested due to automatic review settings October 9, 2026 18:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Irreversible locking behavior and extensive generated SDK contract changes warrant final human validation.

2 open findings

🧠 Review effort: Balanced

@NoriZC

NoriZC commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

/azp run

@NoriZC NoriZC self-assigned this Oct 13, 2026
@azure-pipelines

Copy link
Copy Markdown
Contributor
Azure Pipelines:
Successfully started running 3 pipeline(s).

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants