Skip to content

Adding a prompt to regenerate new SSH Keys#9846

Merged
necusjz merged 2 commits intoAzure:mainfrom
DevanshG1:personal/degoswami/prompt
May 7, 2026
Merged

Adding a prompt to regenerate new SSH Keys#9846
necusjz merged 2 commits intoAzure:mainfrom
DevanshG1:personal/degoswami/prompt

Conversation

@DevanshG1
Copy link
Copy Markdown
Contributor

@DevanshG1 DevanshG1 commented May 5, 2026


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

Related command

General Guidelines

  • Have you run azdev style <YOUR_EXT> locally? (pip install azdev required)
  • Have you run python scripts/ci/test_index.py -q locally? (pip install wheel==0.30.0 required)
  • My extension version conforms to the Extension version schema

For new extensions:

About Extension Publish

There is a pipeline to automatically build, upload and publish extension wheels.
Once your pull request is merged into main branch, a new pull request will be created to update src/index.json automatically.
You only need to update the version information in file setup.py and historical information in file HISTORY.rst in your PR but do not modify src/index.json.

Copilot AI review requested due to automatic review settings May 5, 2026 06:18
@azure-client-tools-bot-prd
Copy link
Copy Markdown

azure-client-tools-bot-prd Bot commented May 5, 2026

⚠️Azure CLI Extensions Breaking Change Test
⚠️sftp
rule cmd_name rule_message suggest_message
⚠️ 1006 - ParaAdd sftp cert cmd sftp cert added parameter yes
⚠️ 1006 - ParaAdd sftp connect cmd sftp connect added parameter yes

@yonzhan
Copy link
Copy Markdown
Collaborator

yonzhan commented May 5, 2026

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

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>

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

@yonzhan yonzhan requested a review from necusjz May 5, 2026 06:22
Copy link
Copy Markdown
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

This PR updates the sftp Azure CLI extension to prompt users before overwriting an existing SSH key pair during key generation for az sftp cert and az sftp connect, and introduces --yes/-y to bypass that prompt.

Changes:

  • Bump sftp extension version to 1.0.0b3 and document the behavior change in HISTORY.rst.
  • Add overwrite-confirmation logic to key generation and wire --yes/-y through command parameters/help.
  • Add unit tests covering the new prompt/overwrite decision logic.

Reviewed changes

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

Show a summary per file
File Description
src/sftp/setup.py Bumps extension version to 1.0.0b3.
src/sftp/HISTORY.rst Documents the overwrite prompt and --yes/-y behavior.
src/sftp/azext_sftp/file_utils.py Implements overwrite prompt logic and integrates it into key generation flow.
src/sftp/azext_sftp/custom.py Plumbs the yes flag into key generation calls for sftp cert / sftp connect.
src/sftp/azext_sftp/_params.py Adds --yes/-y parameters to both commands.
src/sftp/azext_sftp/_help.py Updates help text and examples describing the overwrite prompt and --yes/-y.
src/sftp/azext_sftp/tests/latest/test_file_utils.py Adds unit tests for overwrite prompt and regeneration behavior.

Comment on lines +52 to +54
"Selecting 'n' will use the existing key pair. Overwrite?")
try:
overwrite = prompt_y_n(message, default='y')
# Remove existing files so ssh-keygen does not prompt again to overwrite.
for stale in (private_key_file, public_key_file):
if os.path.isfile(stale):
delete_file(stale, f"Failed to remove existing key file {stale}. ", warning=True)
Comment thread src/sftp/azext_sftp/file_utils.py
@DevanshG1
Copy link
Copy Markdown
Contributor Author

Hey @necusjz is there something missing from my side?

@necusjz
Copy link
Copy Markdown
Member

necusjz commented May 6, 2026

Hey @necusjz is there something missing from my side?

better to rerun the test case and generate/push recordings.

@DevanshG1
Copy link
Copy Markdown
Contributor Author

Hey @necusjz is there something missing from my side?

better to rerun the test case and generate/push recordings.

cant we just run the pipelines again? Or do i need to do it manually?

@yonzhan
Copy link
Copy Markdown
Collaborator

yonzhan commented May 6, 2026

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 2 pipeline(s).

@DevanshG1
Copy link
Copy Markdown
Contributor Author

Hey @necusjz I've validated the tests locally on top of the above. Is there anything else that should be taken care of?

@necusjz necusjz merged commit 599149e into Azure:main May 7, 2026
23 checks passed
@azclibot
Copy link
Copy Markdown
Collaborator

azclibot commented May 7, 2026

[Release] Update index.json for extension [ sftp-1.0.0b3 ] : https://dev.azure.com/msazure/One/_build/results?buildId=163241362&view=results

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.

5 participants