Skip to content

[Redis] Fix #33893: az redis import: Add confirmation prompt matching flush and delete - #33905

Open
Daz (8dazo) wants to merge 3 commits into
Azure:devfrom
8dazo:fix-33893-redis-import-confirmation
Open

[Redis] Fix #33893: az redis import: Add confirmation prompt matching flush and delete#33905
Daz (8dazo) wants to merge 3 commits into
Azure:devfrom
8dazo:fix-33893-redis-import-confirmation

Conversation

@8dazo

Copy link
Copy Markdown
Contributor

Related command
az redis import
az redis import-method
az redis flush
az redis delete

Description
Fixes #33893.

az redis import replaces all cache data and makes the cache unavailable during the operation, but unlike az redis flush and az redis delete it ran with no confirmation prompt and no --yes.

This change uses the same confirmation=True pattern already used by flush and delete:

  • Interactive runs prompt before import
  • --yes / -y skips the prompt
  • Help text states that existing cache data is deleted and the cache is inaccessible during import
  • Hidden az redis import-method gets the same guard because it shares cli_redis_import

Non-interactive scripts that currently call az redis import without -y will need to pass -y, same as flush and delete.

Testing Guide
Local verification (no live cache):

  1. python3 -m py_compile on the three changed files — pass
  2. flake8 on commands.py and _help.py using repo .flake8 — pass
  3. Command table check: az redis delete, az redis flush, az redis import, and az redis import-method all register confirmation=True
  4. Help for import/import-method includes "Deletes all preexisting cache data"
  5. Scenario tests pass -y on import, matching flush/delete

After this ships, --help should match the issue repro:

az redis import --help | grep -- --yes
    --yes -y               : Do not prompt for confirmation.

Skip the prompt in scripts:

az redis import -n MyCache -g MyResourceGroup --files <blobUrl> -y

History Notes
[Redis] az redis import: Add confirmation prompt (--yes) matching az redis flush and az redis delete


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

Made with Cursor

…atching flush and delete

Co-authored-by: Cursor <cursoragent@cursor.com>
Copilot AI lite review requested due to automatic review settings August 17, 2026 07:32
@8dazo
Daz (8dazo) requested review from a team as code owners August 17, 2026 07:32
@azure-client-tools-bot-prd

Copy link
Copy Markdown

Hi Daz (@8dazo),
Since the current milestone time is less than 7 days, this pr may not catch up with this release.

@azure-pipelines

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

@microsoft-github-policy-service microsoft-github-policy-service Bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. Redis Cache Auto-Assign Auto assign by bot act-codegen-extensibility-squad labels Aug 17, 2026

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.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR adds confirmation prompts for destructive Redis import operations and updates tests/help content to support non-interactive execution.

Changes:

  • Require confirmation for az redis import and the deprecated az redis import-method commands.
  • Update scenario tests to pass -y for import operations.
  • Expand help text to warn that import deletes existing cache data and updates examples accordingly.

Reviewed changes

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

File Description
src/azure-cli/azure/cli/command_modules/redis/tests/latest/test_redis_scenario.py Updates tests to include -y so confirmation prompts don’t block CI/live runs.
src/azure-cli/azure/cli/command_modules/redis/commands.py Enables confirmation behavior for import commands at the command table level.
src/azure-cli/azure/cli/command_modules/redis/_help.py Updates help summaries/examples to reflect destructive import behavior and new -y usage.

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

Comment on lines +61 to +62
g.custom_command('import-method', 'cli_redis_import', confirmation=True, deprecate_info=g.deprecate(redirect='redis import', hide=True))
g.custom_command('import', 'cli_redis_import', confirmation=True)
helps['redis import'] = """
type: command
short-summary: Import data into a Redis cache.
short-summary: Import data into a Redis cache. Deletes all preexisting cache data, and the cache is inaccessible to clients during the import.
Comment on lines 196 to 197
short-summary: Import data into Redis cache. Deletes all preexisting cache data, and the cache is inaccessible to clients during the import.
long-summary: Usage example - az redis import-method --name testCacheName --resource-group testResourceGroup --files [--file-format]
@8dazo

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

Co-authored-by: Cursor <cursoragent@cursor.com>
@8dazo

Copy link
Copy Markdown
Contributor Author

Yong Zhang (@yonzhan) could you verify this when you have a chance?

az redis import / import-method now prompt with a destructive-data message (skip with --yes/-y), matching flush/delete. Copilot's review is addressed: custom confirmation wording, and the downtime note is in long-summary while short-summary still states that existing cache data is deleted.

@yonzhan

Copy link
Copy Markdown
Collaborator

Adding Qi Pan (@Pan-Qi) to help review this PR

@coopercox-ms Cooper Cox (coopercox-ms) added the azure-client-tools-agent Pull request reviewed by Azure Client Tools Agent label Aug 18, 2026
Co-authored-by: Cursor <cursoragent@cursor.com>

@Pan-Qi Qi Pan (Pan-Qi) 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.

Please re-record tests

@a0x1ab Aditya Pujara (a0x1ab) added Azure Client Tools Agent Requested Request Azure Client Tools Agent testing and review and removed azure-client-tools-agent Pull request reviewed by Azure Client Tools Agent labels Aug 19, 2026
@coopercox-ms

Copy link
Copy Markdown
Member

Daz (@8dazo) can you please re-record tests for your changes. Thanks!

@8dazo

Copy link
Copy Markdown
Contributor Author

Cooper Cox (@coopercox-ms) The -y flags are on az redis import / import-method so the tests match the new confirmation prompt. Those commands are still commented out in test_redis_cache_export_import, so they are not in the recordings and a re-record would not capture -y. I don’t have an Azure subscription to run live Redis tests. Please re-record on your side if you still want that, or I can uncomment the SAS import path if you prefer.

@coopercox-ms

Copy link
Copy Markdown
Member

Thanks Daz (@8dazo), you’re correct. I confirmed the SAS import commands are inside a disabled triple-quoted block, and the managed-identity import remains commented, so re-recording the current scenario would not exercise or capture -y . Since -y is CLI-side, it would not change the HTTP cassette either. Please don’t uncomment the SAS import flow solely for this change.

Qi Pan (@Pan-Qi), could you clarify whether you would prefer the no-op test edits to be reverted and replaced with a focused non-live confirmation/help test?

There is also a release-policy question: adding confirmation to an existing command means existing non-interactive scripts must add -y , which appears to meet Azure CLI’s definition of a breaking behavior change.
Should we split this into warning/help pre-announcement now and confirmation in the next breaking window, or is the production data-loss justification being treated as an approved exception?

@azure-client-tools-agent azure-client-tools-agent Bot 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.

Automated review — PR #33905

CI: 8/9 checks passed. azdev-style has been queued for 6+ hours (stale) and could not be automatically re-triggered this round; not treated as a failure since nothing has actually failed.

Live test (azdev test --live --series): ❌ 1 failed, 1 passed (52m28s run). The failure is:

azure.cli.core.azclierror.AuthenticationError: AADSTS700024: Client assertion is not within
its valid time range. Current time: 2026-08-19T05:55:00Z, assertion valid from 04:58:58Z,
expiry time of assertion 05:03:58Z.

in test_redis_cache_authentication (command_modules/redis/tests/latest/test_redis_scenario.py).

This looks like a test-infrastructure flake, not a defect in the PR: the federated OIDC
token used for live testing expired mid-run because this test suite took ~52 minutes, far
longer than the ~5 minute token validity window. It is unrelated to the PR's actual change
(adding a confirmation prompt for az redis import).

Given @Pan-Qi already requested "Please re-record tests" on this PR, please re-run/re-record
once ready — the failure above should not block on the automation and looks like an
environment issue rather than a code issue.

@azure-client-tools-agent azure-client-tools-agent Bot added azure-client-tools-agent Pull request reviewed by Azure Client Tools Agent and removed Azure Client Tools Agent Requested Request Azure Client Tools Agent testing and review labels Aug 19, 2026
@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

🔔 Routing this PR to @Azure/act-codegen-extensibility-squad.

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

Labels

act-codegen-extensibility-squad Auto-Assign Auto assign by bot azure-client-tools-agent Pull request reviewed by Azure Client Tools Agent customer-reported Issues that are reported by GitHub users external to the Azure organization. Redis Cache

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

6 participants