From a95b3bac5c44c29fbeea6b9853521bea0052b918 Mon Sep 17 00:00:00 2001 From: maximsemenov Date: Tue, 10 Nov 2026 15:19:45 -0800 Subject: [PATCH 1/3] ci: use the classic IoT Hub host for e2e service calls Hubs created since 2026-11-10 report the device endpoint (.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 .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> --- vsts/dps-e2e.yaml | 4 ++++ vsts/python-e2e.yaml | 3 +++ vsts/python-nightly.yaml | 3 +++ 3 files changed, 10 insertions(+) diff --git a/vsts/dps-e2e.yaml b/vsts/dps-e2e.yaml index bed45ee66..64bdaf3cc 100644 --- a/vsts/dps-e2e.yaml +++ b/vsts/dps-e2e.yaml @@ -228,6 +228,10 @@ stages: fi export IOTHUB_CONNECTION_STRING=$(az iot hub connection-string show -g $AZURE_RESOURCE_GROUP --hub-name $AZURE_IOTHUB_NAME --pn iothubowner --query "connectionString" --output tsv) + # Newly created hubs report the device endpoint (.device.azure-devices.net), which does not + # serve registry (service) calls (HTTP 400). Use the classic host for service operations and for + # linking the hub to DPS, so the assigned hub reported by DPS matches the test's linked hub. + export IOTHUB_CONNECTION_STRING=${IOTHUB_CONNECTION_STRING/.device.azure-devices.net/.azure-devices.net} export EVENTHUB_CONNECTION_STRING=$(az iot hub connection-string show -g $AZURE_RESOURCE_GROUP --hub-name $AZURE_IOTHUB_NAME --eh --query "connectionString" --output tsv) time az iot dps linked-hub create -g $AZURE_RESOURCE_GROUP --dps-name $AZURE_DPS_NAME --connection-string "$IOTHUB_CONNECTION_STRING" diff --git a/vsts/python-e2e.yaml b/vsts/python-e2e.yaml index ad60f0667..2f9164a15 100644 --- a/vsts/python-e2e.yaml +++ b/vsts/python-e2e.yaml @@ -53,6 +53,9 @@ stages: time az iot hub create -g $AZURE_RESOURCE_GROUP -n $AZURE_IOTHUB_NAME --dla false --mintls 1.2 --partition-count 4 --sku S1 export IOTHUB_CONNECTION_STRING=$(az iot hub connection-string show -g $AZURE_RESOURCE_GROUP --hub-name $AZURE_IOTHUB_NAME --pn iothubowner --query "connectionString" --output tsv) + # Newly created hubs report the device endpoint (.device.azure-devices.net), which does not + # serve registry (service) calls (HTTP 400). Use the classic host for service operations. + export IOTHUB_CONNECTION_STRING=${IOTHUB_CONNECTION_STRING/.device.azure-devices.net/.azure-devices.net} export EVENTHUB_CONNECTION_STRING=$(az iot hub connection-string show -g $AZURE_RESOURCE_GROUP --hub-name $AZURE_IOTHUB_NAME --eh --query "connectionString" --output tsv) # Limit Azure API concurrency while creating independent groups faster. diff --git a/vsts/python-nightly.yaml b/vsts/python-nightly.yaml index 662a4fba6..94a6effa7 100644 --- a/vsts/python-nightly.yaml +++ b/vsts/python-nightly.yaml @@ -36,6 +36,9 @@ stages: time az iot hub create -g $AZURE_RESOURCE_GROUP -n $AZURE_IOTHUB_NAME --dla false --mintls 1.2 --partition-count 4 --sku S1 export IOTHUB_CONNECTION_STRING=$(az iot hub connection-string show -g $AZURE_RESOURCE_GROUP --hub-name $AZURE_IOTHUB_NAME --pn iothubowner --query "connectionString" --output tsv) + # Newly created hubs report the device endpoint (.device.azure-devices.net), which does not + # serve registry (service) calls (HTTP 400). Use the classic host for service operations. + export IOTHUB_CONNECTION_STRING=${IOTHUB_CONNECTION_STRING/.device.azure-devices.net/.azure-devices.net} export EVENTHUB_CONNECTION_STRING=$(az iot hub connection-string show -g $AZURE_RESOURCE_GROUP --hub-name $AZURE_IOTHUB_NAME --eh --query "connectionString" --output tsv) # Limit Azure API concurrency while creating independent groups faster. From 085be58e314886848b0119755fc23687aaa5e040 Mon Sep 17 00:00:00 2001 From: maximsemenov Date: Thu, 12 Nov 2026 13:31:47 -0800 Subject: [PATCH 2/3] ci: use --hostname-type classic instead of rewriting the connection string 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> --- vsts/dps-e2e.yaml | 8 ++------ vsts/python-e2e.yaml | 5 +---- vsts/python-nightly.yaml | 5 +---- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/vsts/dps-e2e.yaml b/vsts/dps-e2e.yaml index 64bdaf3cc..bc1e525fb 100644 --- a/vsts/dps-e2e.yaml +++ b/vsts/dps-e2e.yaml @@ -227,14 +227,10 @@ stages: exit 1 fi - export IOTHUB_CONNECTION_STRING=$(az iot hub connection-string show -g $AZURE_RESOURCE_GROUP --hub-name $AZURE_IOTHUB_NAME --pn iothubowner --query "connectionString" --output tsv) - # Newly created hubs report the device endpoint (.device.azure-devices.net), which does not - # serve registry (service) calls (HTTP 400). Use the classic host for service operations and for - # linking the hub to DPS, so the assigned hub reported by DPS matches the test's linked hub. - export IOTHUB_CONNECTION_STRING=${IOTHUB_CONNECTION_STRING/.device.azure-devices.net/.azure-devices.net} + export IOTHUB_CONNECTION_STRING=$(az iot hub connection-string show -g $AZURE_RESOURCE_GROUP --hub-name $AZURE_IOTHUB_NAME --pn iothubowner --hostname-type classic --query "connectionString" --output tsv) export EVENTHUB_CONNECTION_STRING=$(az iot hub connection-string show -g $AZURE_RESOURCE_GROUP --hub-name $AZURE_IOTHUB_NAME --eh --query "connectionString" --output tsv) - time az iot dps linked-hub create -g $AZURE_RESOURCE_GROUP --dps-name $AZURE_DPS_NAME --connection-string "$IOTHUB_CONNECTION_STRING" + time az iot dps linked-hub create -g $AZURE_RESOURCE_GROUP --dps-name $AZURE_DPS_NAME --connection-string "$IOTHUB_CONNECTION_STRING" --hostname-type classic export DPS_CONNECTION_STRING=$(az iot dps connection-string show -g $AZURE_RESOURCE_GROUP --dps-name $AZURE_DPS_NAME --policy-name provisioningserviceowner --query "connectionString" --output tsv) export DPS_ID_SCOPE=$(az iot dps show --name $AZURE_DPS_NAME -g $AZURE_RESOURCE_GROUP --query properties.idScope --output tsv) diff --git a/vsts/python-e2e.yaml b/vsts/python-e2e.yaml index 2f9164a15..12ec7bbdf 100644 --- a/vsts/python-e2e.yaml +++ b/vsts/python-e2e.yaml @@ -52,10 +52,7 @@ stages: time az iot hub create -g $AZURE_RESOURCE_GROUP -n $AZURE_IOTHUB_NAME --dla false --mintls 1.2 --partition-count 4 --sku S1 - export IOTHUB_CONNECTION_STRING=$(az iot hub connection-string show -g $AZURE_RESOURCE_GROUP --hub-name $AZURE_IOTHUB_NAME --pn iothubowner --query "connectionString" --output tsv) - # Newly created hubs report the device endpoint (.device.azure-devices.net), which does not - # serve registry (service) calls (HTTP 400). Use the classic host for service operations. - export IOTHUB_CONNECTION_STRING=${IOTHUB_CONNECTION_STRING/.device.azure-devices.net/.azure-devices.net} + export IOTHUB_CONNECTION_STRING=$(az iot hub connection-string show -g $AZURE_RESOURCE_GROUP --hub-name $AZURE_IOTHUB_NAME --pn iothubowner --hostname-type classic --query "connectionString" --output tsv) export EVENTHUB_CONNECTION_STRING=$(az iot hub connection-string show -g $AZURE_RESOURCE_GROUP --hub-name $AZURE_IOTHUB_NAME --eh --query "connectionString" --output tsv) # Limit Azure API concurrency while creating independent groups faster. diff --git a/vsts/python-nightly.yaml b/vsts/python-nightly.yaml index 94a6effa7..15032fa44 100644 --- a/vsts/python-nightly.yaml +++ b/vsts/python-nightly.yaml @@ -35,10 +35,7 @@ stages: time az iot hub create -g $AZURE_RESOURCE_GROUP -n $AZURE_IOTHUB_NAME --dla false --mintls 1.2 --partition-count 4 --sku S1 - export IOTHUB_CONNECTION_STRING=$(az iot hub connection-string show -g $AZURE_RESOURCE_GROUP --hub-name $AZURE_IOTHUB_NAME --pn iothubowner --query "connectionString" --output tsv) - # Newly created hubs report the device endpoint (.device.azure-devices.net), which does not - # serve registry (service) calls (HTTP 400). Use the classic host for service operations. - export IOTHUB_CONNECTION_STRING=${IOTHUB_CONNECTION_STRING/.device.azure-devices.net/.azure-devices.net} + export IOTHUB_CONNECTION_STRING=$(az iot hub connection-string show -g $AZURE_RESOURCE_GROUP --hub-name $AZURE_IOTHUB_NAME --pn iothubowner --hostname-type classic --query "connectionString" --output tsv) export EVENTHUB_CONNECTION_STRING=$(az iot hub connection-string show -g $AZURE_RESOURCE_GROUP --hub-name $AZURE_IOTHUB_NAME --eh --query "connectionString" --output tsv) # Limit Azure API concurrency while creating independent groups faster. From 592adba60f09342b880508568a1eba0953feed35 Mon Sep 17 00:00:00 2001 From: maximsemenov Date: Mon, 16 Nov 2026 08:48:54 -0800 Subject: [PATCH 3/3] ci: fix the nightly marker expression for pytest 9.2 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> --- vsts/python-nightly.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vsts/python-nightly.yaml b/vsts/python-nightly.yaml index 15032fa44..9c6e63754 100644 --- a/vsts/python-nightly.yaml +++ b/vsts/python-nightly.yaml @@ -191,8 +191,10 @@ stages: - script: | cd $(Build.SourcesDirectory)/tests/e2e/iothub_e2e echo "Using consumer group: ${IOTHUB_E2E_EVENTHUB_CONSUMER_GROUP}" - # "not x" means "include all tests that don't have the tag named 'x'", which is everything. - uv run --no-sync pytest --transport=$(transport) --junitxml=junit/TEST-python-e2e.xml -o junit_suite_name="$(Agent.JobName)" -m "not x" + # The nightly runs every test, including the stress tests that pytest.ini deselects by default + # (addopts -m "not stress"); a command-line -m replaces that default. Use only registered + # markers: pytest 9.2+ rejects unknown marker names in -m with --strict-markers. + uv run --no-sync pytest --transport=$(transport) --junitxml=junit/TEST-python-e2e.xml -o junit_suite_name="$(Agent.JobName)" -m "stress or not stress" displayName: 'E2E Device Client MQTT Connection String' env: IOTHUB_E2E_IOTHUB_CONNECTION_STRING: $(IOTHUB_CONNECTION_STRING)