Skip to content

az redis import should carry a destructive-data warning and confirmation prompt (--yes), matching az redis flush and az redis delete #33893

Description

Related command

az redis import

Is your feature request related to a problem? Please describe.

az redis import is a destructive operation: per the Azure Cache for Redis documentation, "Importing data deletes preexisting cache data, and the cache isn't accessible by cache clients during the import process" (https://learn.microsoft.com/en-us/azure/azure-cache-for-redis/cache-how-to-import-export-data). Functionally it is flush-plus-load.

The CLI does not signal this anywhere:

  • No confirmation prompt and no --yes flag. The command executes immediately.
  • The help text reads only "Import data into a Redis cache", with no mention that existing data is deleted or that the cache is unavailable to clients during the import.

This is inconsistent with the sibling commands in the same group, which are equally or less destructive and both prompt:

$ az redis delete --help | grep -A1 -- --yes
    --yes -y               : Do not prompt for confirmation.

$ az redis flush --help | grep -A1 -- --yes
    --yes -y               : Do not prompt for confirmation.

$ az redis import --help | grep -c -- --yes
0

Observed on azure-cli 2.88.0.

The practical consequence: an operator who knows flush and delete are guarded reasonably assumes import is not in the same destructive class, because the CLI itself communicates that classification through prompts. We investigated a production data-loss incident in which az redis import was run against a production cache as a diagnostic step and the cache's contents were lost. A confirmation prompt stating "this deletes all existing data in the cache" would very likely have stopped the command from being run.

Describe the solution you'd like

  1. Add a confirmation prompt to az redis import (the standard prompt_y_n pattern), suppressible with --yes/-y, with wording that states existing cache data will be deleted and the cache will be inaccessible to clients during the import.
  2. Update the command's help/short summary to carry the same warning, so it also surfaces in az redis import --help and the reference docs.

If adding a prompt to an existing command is considered a breaking change, a reasonable path is to emit a prominent warning immediately and introduce the prompt at the next breaking-change window, as has been done for other commands.

Describe alternatives you've considered

  • Documentation-only fix (help-text change without a prompt): better than nothing, but it does not protect scripted or hurried invocations the way the existing flush/delete prompts do.
  • Client-side wrappers/policy in our own tooling: we have done this, but it fixes only our estate; the inconsistency remains a trap for every other azure-cli user.

Additional context

az redis import-method (if still present) and az redisenterprise database import may deserve the same review, since the underlying service behavior (import replaces existing data) is the same.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions