Skip to content

[bastion] Fix KeyError when enableTunneling is absent from bastion API response#10000

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/bastion-fix-ssh-keyerror
Draft

[bastion] Fix KeyError when enableTunneling is absent from bastion API response#10000
Copilot wants to merge 2 commits into
mainfrom
copilot/bastion-fix-ssh-keyerror

Conversation

Copilot AI commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

az network bastion ssh, rdp, and tunnel commands crash with KeyError: 'enableTunneling' when the bastion host's API response omits that property (e.g., Standard SKU with tunneling not explicitly configured).

Changes

  • _is_nativeclient_enabled: bastion['enableTunneling']bastion.get('enableTunneling', False)
  • rdp_bastion_host and create_bastion_tunnel: same fix for the inline SKU+tunneling guards that bypass _is_nativeclient_enabled
  • New unit tests (test_bastion_unit.py): covers all SKU variants including the missing-key regression case

Related command

az network bastion ssh / az network bastion rdp / az network bastion tunnel

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? (azdev required; see .azure-pipelines/templates/azdev_setup.yml for the install command until azdev==0.2.11b1 is on PyPI)
  • 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.

@azure-client-tools-bot-prd

azure-client-tools-bot-prd Bot commented Jun 22, 2026

Copy link
Copy Markdown
️✔️Azure CLI Extensions Breaking Change Test
️✔️Non Breaking Changes

@azure-client-tools-bot-prd

Copy link
Copy Markdown

Hi @copilot,
Please write the description of changes which can be perceived by customers into HISTORY.rst.
If you want to release a new extension version, please update the version in setup.py as well.

Copilot AI changed the title [WIP] Fix KeyError in az network bastion ssh command [bastion] Fix KeyError when enableTunneling is absent from bastion API response Jun 22, 2026
Copilot AI requested a review from a0x1ab June 22, 2026 16:12
@yonzhan

yonzhan commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

bastion

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 Network

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants