Skip to content

fix: hostname routing in module/device#833

Merged
cheatsheet1999 merged 3 commits into
previewfrom
yuelinzhao/fix-items-in-bug-bash-521
May 26, 2026
Merged

fix: hostname routing in module/device#833
cheatsheet1999 merged 3 commits into
previewfrom
yuelinzhao/fix-items-in-bug-bash-521

Conversation

@cheatsheet1999
Copy link
Copy Markdown
Member

Two bug fixes from bug bash:

  • az iot hub device-identity connection-string show
    az iot hub module-identity connection-string show

    Update: Reject --hostname-type service.

  • az iot hub generate-sas-token

    Update: Add --hostname-type / --ht. The audience (sr=) defaults to:
    - service hostname for hub-scoped tokens (no -d)
    - device hostname for device/module-scoped tokens (-d / -d -m)
    - classic, device and service are explicitly selectable.

@cheatsheet1999 cheatsheet1999 marked this pull request as ready for review May 22, 2026 23:38
@cheatsheet1999 cheatsheet1999 requested a review from digimaun as a code owner May 22, 2026 23:38
Copilot AI review requested due to automatic review settings May 22, 2026 23:38
Copy link
Copy Markdown

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 adjusts IoT Hub hostname selection behavior for device/module connection-string commands and for SAS token generation, aligning “audience” (sr=) routing with GWv2 TLS 1.3 hostnames and adding test coverage for the new permutations.

Changes:

  • Reject --hostname-type service for device-identity connection-string show and module-identity connection-string show.
  • Add --hostname-type/--ht to az iot hub generate-sas-token and route SAS audience (sr=) based on scope and selected hostname type.
  • Add unit + integration tests validating hostname-type permutations and sr= audience values; bump extension version and update changelog/help examples.

Reviewed changes

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

Show a summary per file
File Description
HISTORY.rst Documents the bug fixes and new --hostname-type behavior for SAS tokens.
azext_iot/constants.py Bumps extension version to 0.31.0b2.
azext_iot/operations/hub.py Implements SAS audience hostname routing and rejects service hostname type for device/module connection strings.
azext_iot/_params.py Adds --hostname-type/--ht parameter to iot hub generate-sas-token.
azext_iot/_help.py Adds new generate-sas-token examples demonstrating --hostname-type.
azext_iot/tests/iothub/core/test_iothub_utilities_unit.py Adds unit tests for SAS audience routing + CS-show service-hostname rejection.
azext_iot/tests/iothub/core/test_iothub_utilities_int.py Adds integration coverage for hub-level SAS hostname-type permutations.
azext_iot/tests/iothub/devices/test_iothub_devices_int.py Adds integration coverage for device-scope CS-show + SAS hostname-type permutations.
azext_iot/tests/iothub/modules/test_iothub_modules_int.py Adds integration coverage for module-scope CS-show + SAS hostname-type permutations.

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

Comment thread azext_iot/operations/hub.py Outdated
Comment thread azext_iot/_params.py Outdated
Comment thread azext_iot/tests/iothub/core/test_iothub_utilities_unit.py
Comment thread azext_iot/tests/iothub/core/test_iothub_utilities_unit.py Outdated
Comment thread azext_iot/operations/hub.py
Comment thread azext_iot/operations/hub.py Outdated
HangyiWang
HangyiWang previously approved these changes May 23, 2026
@cheatsheet1999 cheatsheet1999 merged commit 6c5147e into preview May 26, 2026
41 checks passed
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