Repository navigation
ci: use --hostname-type classic for the IoT Hub connection string in e2e pipelines - #1270
Merged
Carter Tinney (cartertinney) merged 3 commits intoNov 17, 2026
Conversation
Hubs created since 2026-11-10 report the device endpoint (<hub>.device.azure-devices.net) in the connection string returned by `az iot hub connection-string show`. That endpoint does not serve registry (service) operations: the DPS e2e helper and the azure-iot-hub registry manager get HTTP 400 on get_device / create_device_with_sas, which broke the DPS e2e and Python E2E pipelines on main (same commit passed on 2026-10-27). Rewrite the host in IOTHUB_CONNECTION_STRING to the classic <hub>.azure-devices.net right after it is generated, in the three pipelines that create a hub. In the DPS pipeline this happens before the hub is linked to DPS, so the assigned hub reported by DPS still matches the test's linked hub. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Maxim Semenov (maximsemenov80)
marked this pull request as ready for review
November 11, 2026 00:05
Maxim Semenov (maximsemenov80)
requested review from
Carter Tinney (cartertinney) and
Ewerton Scaboro da Silva (ewertons)
and
a balanced review from Copilot
November 11, 2026 00:16
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the pipeline hostname-normalization changes.
No open issues 🎉
What changed in this PR
Restores IoT Hub registry/service calls in the Python and DPS pipelines by normalizing generated connection strings to the classic hostname.
Changes:
- Replaces
.device.azure-devices.netwith.azure-devices.netin three pipeline setup scripts without requiring newer CLI flags. - Applies the rewrite before DPS hub linking so the assigned hostname matches the tests’ expected hostname.
| File | Description |
|---|---|
vsts/python-nightly.yaml |
Normalizes the IoT Hub hostname for nightly service calls. |
vsts/python-e2e.yaml |
Normalizes the IoT Hub hostname for Python end-to-end service calls. |
vsts/dps-e2e.yaml |
Normalizes the hostname before service calls and DPS hub linking. |
Review effort: Balanced
…tring Use the supported azure-iot option rather than a string rewrite: pass --hostname-type classic to `az iot hub connection-string show` (all three pipelines) and to `az iot dps linked-hub create` (DPS e2e). The extension is installed on demand at its latest stable version in these pipelines, which supports the option, so there is no older version to accommodate. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The nightly passes -m "not x" so that it runs every test, including the stress tests that tests/e2e/iothub_e2e/pytest.ini deselects by default (addopts -m "not stress"); a command-line -m replaces that default. "x" is not a registered marker, and pytest 9.2.0 (2026-10-27) now validates marker names in -m expressions when --strict-markers is on, so every test leg fails with "Unknown marker(s) in '-m' expression: x" before running a test. Use "stress or not stress" instead: it selects every test and only references a registered marker. Simply dropping -m would silently stop running the stress tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Carter Tinney (cartertinney)
approved these changes
Nov 17, 2026
Carter Tinney (cartertinney)
deleted the
maximsemenov/e2e-use-classic-iothub-host
branch
November 17, 2026 17:50
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.
Problem
The
DPS e2e(def 331) andPython E2E(def 426) pipelines fail onmainsince 2026-11-10 withHttpOperationError: ... 'Bad Request'on IoT Hub registry calls (get_device,create_device_with_sas). The same commit (3c779496) passed on 2026-10-27.Root cause
These pipelines install the
azure-iotAzure CLI extension on demand (The command requires the extension azure-iot. It will be installed first) and get the latest stable; nothing pins it, and the Azure CLI itself comes from the hosted image.azure-iot1.0.0 (released 2026-11-05) lists a breaking change in its release history: "Hub connection-string/SAS and DPS linked-Hub creation commands default to automatic hostname selection."So
az iot hub connection-string shownow returnsHostName=<hub>.device.azure-devices.net(the device endpoint, TLS 1.3 preview) instead of<hub>.azure-devices.net. The test helpers and theazure-iot-hubregistry manager take the host from that connection string and send registry (service) calls to the device endpoint, which answers 400. In the failing DPS run the earlier asserts pass (registration isassignedto the right hub); only the registry lookup fails.Fix
Pass
--hostname-type classic(supported byazure-iot1.0.0; confirmed in--helpfor both commands):az iot hub connection-string show ... --pn iothubowner --hostname-type classicindps-e2e.yaml,python-e2e.yamlandpython-nightly.yaml.az iot dps linked-hub create ... --hostname-type classicindps-e2e.yaml, so DPS links the classic host and the assigned hub it reports matches the test's linked hub.The event hub connection string (
--eh) is ansb://endpoint and is left unchanged. (An earlier revision of this PR rewrote the host with a bash substitution; replaced by the supported option.)Verification
Queued on this branch (commit
085be58e):main, build 166137); the setup log shows only<hub>.azure-devices.netERROR: Unknown marker(s) in '-m' expression: x, which is unrelated to this PR (see below)Not covered
python-nightly.yamlrunspytest ... -m "not x". pytest 9.2.0 (2026-10-27) now validates marker names in-mexpressions whenstrict_markersis on, so this fails onmaintoo, independent of this change. Removing-m "not x"(it selects everything) is a separate fix.Azure/iot-sdks-e2e-fx; they may need the same change there..device.endpoint, which real users may now get fromaz iot hub connection-string showand the portal.Also included: nightly marker fix (was #1271)
python-nightlyis a gate on this PR and was failing withUnknown marker(s) in '-m' expression: x: pytest 9.2.0 validates marker names in-munder--strict-markers.-m "not x"is changed to-m "stress or not stress", which still runs every test, including the stress tests thatpytest.inideselects by default. Dropping-mwould silently skip them.It is combined here because neither change can pass the PR gates alone: the hostname fix needs the nightly gate green, and the marker fix needs the hub setup fixed. Verified together on
python-nightlybuild 166372 (all 11 legs passed, 112 passed / 20 skipped each).