fix: hostname routing in module/device#833
Merged
Merged
Conversation
There was a problem hiding this comment.
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 servicefordevice-identity connection-string showandmodule-identity connection-string show. - Add
--hostname-type/--httoaz iot hub generate-sas-tokenand 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.
ketkimnaik
reviewed
May 22, 2026
HangyiWang
reviewed
May 23, 2026
HangyiWang
reviewed
May 23, 2026
HangyiWang
previously approved these changes
May 23, 2026
ketkimnaik
approved these changes
May 26, 2026
HangyiWang
approved these changes
May 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two bug fixes from bug bash:
az iot hub device-identity connection-string showaz iot hub module-identity connection-string showUpdate: Reject --hostname-type service.
az iot hub generate-sas-tokenUpdate: 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.