Skip to content

Comments

[Sql]'az sql ltr-policy update': Add prompt when customer set locked on immutability-mode #32821

Open
lixiachena wants to merge 1 commit intoAzure:devfrom
lixiachena:modePrompt
Open

[Sql]'az sql ltr-policy update': Add prompt when customer set locked on immutability-mode #32821
lixiachena wants to merge 1 commit intoAzure:devfrom
lixiachena:modePrompt

Conversation

@lixiachena
Copy link
Contributor

Related command

Description

Add a prompt for customer to be aware of impact of locked immutability-mode
Testing Guide


This checklist is used to make sure that common guidelines for a pull request are followed.

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

azure-client-tools-bot-prd bot commented Feb 20, 2026

️✔️AzureCLI-FullTest
️✔️acr
️✔️latest
️✔️3.12
️✔️3.13
️✔️acs
️✔️latest
️✔️3.12
️✔️3.13
️✔️advisor
️✔️latest
️✔️3.12
️✔️3.13
️✔️ams
️✔️latest
️✔️3.12
️✔️3.13
️✔️apim
️✔️latest
️✔️3.12
️✔️3.13
️✔️appconfig
️✔️latest
️✔️3.12
️✔️3.13
️✔️appservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️aro
️✔️latest
️✔️3.12
️✔️3.13
️✔️backup
️✔️latest
️✔️3.12
️✔️3.13
️✔️batch
️✔️latest
️✔️3.12
️✔️3.13
️✔️batchai
️✔️latest
️✔️3.12
️✔️3.13
️✔️billing
️✔️latest
️✔️3.12
️✔️3.13
️✔️botservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️cdn
️✔️latest
️✔️3.12
️✔️3.13
️✔️cloud
️✔️latest
️✔️3.12
️✔️3.13
️✔️cognitiveservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️compute_recommender
️✔️latest
️✔️3.12
️✔️3.13
️✔️computefleet
️✔️latest
️✔️3.12
️✔️3.13
️✔️config
️✔️latest
️✔️3.12
️✔️3.13
️✔️configure
️✔️latest
️✔️3.12
️✔️3.13
️✔️consumption
️✔️latest
️✔️3.12
️✔️3.13
️✔️container
️✔️latest
️✔️3.12
️✔️3.13
️✔️containerapp
️✔️latest
️✔️3.12
️✔️3.13
️✔️core
️✔️latest
️✔️3.12
️✔️3.13
️✔️cosmosdb
️✔️latest
️✔️3.12
️✔️3.13
️✔️databoxedge
️✔️latest
️✔️3.12
️✔️3.13
️✔️dls
️✔️latest
️✔️3.12
️✔️3.13
️✔️dms
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventgrid
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventhubs
️✔️latest
️✔️3.12
️✔️3.13
️✔️feedback
️✔️latest
️✔️3.12
️✔️3.13
️✔️find
️✔️latest
️✔️3.12
️✔️3.13
️✔️hdinsight
️✔️latest
️✔️3.12
️✔️3.13
️✔️identity
️✔️latest
️✔️3.12
️✔️3.13
️✔️iot
️✔️latest
️✔️3.12
️✔️3.13
️✔️keyvault
️✔️latest
️✔️3.12
️✔️3.13
️✔️lab
️✔️latest
️✔️3.12
️✔️3.13
️✔️managedservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️maps
️✔️latest
️✔️3.12
️✔️3.13
️✔️marketplaceordering
️✔️latest
️✔️3.12
️✔️3.13
️✔️monitor
️✔️latest
️✔️3.12
️✔️3.13
️✔️mysql
️✔️latest
️✔️3.12
️✔️3.13
️✔️netappfiles
️✔️latest
️✔️3.12
️✔️3.13
️✔️network
️✔️latest
️✔️3.12
️✔️3.13
️✔️policyinsights
️✔️latest
️✔️3.12
️✔️3.13
️✔️postgresql
️✔️latest
️✔️3.12
️✔️3.13
️✔️privatedns
️✔️latest
️✔️3.12
️✔️3.13
️✔️profile
️✔️latest
️✔️3.12
️✔️3.13
️✔️rdbms
️✔️latest
️✔️3.12
️✔️3.13
️✔️redis
️✔️latest
️✔️3.12
️✔️3.13
️✔️relay
️✔️latest
️✔️3.12
️✔️3.13
️✔️resource
️✔️latest
️✔️3.12
️✔️3.13
️✔️role
️✔️latest
️✔️3.12
️✔️3.13
️✔️search
️✔️latest
️✔️3.12
️✔️3.13
️✔️security
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicebus
️✔️latest
️✔️3.12
️✔️3.13
️✔️serviceconnector
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicefabric
️✔️latest
️✔️3.12
️✔️3.13
️✔️signalr
️✔️latest
️✔️3.12
️✔️3.13
️✔️sql
️✔️latest
️✔️3.12
️✔️3.13
️✔️sqlvm
️✔️latest
️✔️3.12
️✔️3.13
️✔️storage
️✔️latest
️✔️3.12
️✔️3.13
️✔️synapse
️✔️latest
️✔️3.12
️✔️3.13
️✔️telemetry
️✔️latest
️✔️3.12
️✔️3.13
️✔️util
️✔️latest
️✔️3.12
️✔️3.13
️✔️vm
️✔️latest
️✔️3.12
️✔️3.13

@yonzhan
Copy link
Collaborator

yonzhan commented Feb 20, 2026

Thank you for your contribution! We will review the pull request and get back to you soon.

@azure-client-tools-bot-prd
Copy link

Hi @lixiachena,
Since the current milestone time is less than 7 days, this pr will be reviewed in the next milestone.

@github-actions
Copy link

The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR.

Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions).
After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

@azure-client-tools-bot-prd
Copy link

azure-client-tools-bot-prd bot commented Feb 20, 2026

️✔️AzureCLI-BreakingChangeTest
️✔️Non Breaking Changes

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

Adds an extra interactive confirmation to az sql db ltr-policy set when the user sets time-based immutability mode to Locked, to ensure customers acknowledge the irreversible impact.

Changes:

  • Prompt for confirmation when --tb-immutability-mode locked is specified (unless --yes is provided).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

if time_based_immutability_mode.lower() == 'locked':
if not yes:
confirmation = prompt_y_n("""Once locked, immutable backups cannot be modified or deleted for the full retention period. There is no extra cost to enable immutability, but standard backup storage charges apply. Note: The logical Azure SQL Server cannot be deleted during the retention period.
Do you want to proceed?""")
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

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

For an irreversible action like setting immutability mode to locked, it’s safer to explicitly set the prompt default to “no” (and avoid relying on prompt_y_n’s library default). This reduces the risk of an accidental lock by hitting Enter, while still allowing automation via --yes.

Suggested change
Do you want to proceed?""")
Do you want to proceed?""", default='n')

Copilot uses AI. Check for mistakes.
Comment on lines +3145 to +3146
confirmation = prompt_y_n("""Once locked, immutable backups cannot be modified or deleted for the full retention period. There is no extra cost to enable immutability, but standard backup storage charges apply. Note: The logical Azure SQL Server cannot be deleted during the retention period.
Do you want to proceed?""")
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

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

The confirmation message is embedded as a single very long line with a newline + indentation in the middle, which will include leading spaces in the rendered prompt and is hard to maintain. Consider formatting it as multiple shorter lines (or dedenting) so the CLI output is clean and future edits don’t require touching an overlong literal.

Copilot uses AI. Check for mistakes.
Comment on lines +3143 to +3148
if time_based_immutability_mode.lower() == 'locked':
if not yes:
confirmation = prompt_y_n("""Once locked, immutable backups cannot be modified or deleted for the full retention period. There is no extra cost to enable immutability, but standard backup storage charges apply. Note: The logical Azure SQL Server cannot be deleted during the retention period.
Do you want to proceed?""")
if not confirmation:
return
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

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

When users pass both --tb-immutability Enabled and --tb-immutability-mode Locked in the same call, they will be prompted twice (once for enabling immutability above, and again here for locking). Consider consolidating into a single confirmation when mode is locked (e.g., skip the earlier prompt or make the earlier prompt conditional on mode != locked) to avoid redundant interactive prompts.

Copilot uses AI. Check for mistakes.
@yonzhan yonzhan assigned calvinhzy and unassigned evelyn-ys Feb 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Auto-Assign Auto assign by bot SQL az sql

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants