Repository navigation
Run Python E2E, python-nightly and dps-e2e against hubs with local auth disabled - #1278
Merged
Ewerton Scaboro da Silva (ewertons) merged 6 commits intoDec 4, 2026
Merged
Conversation
Both pipelines now create their IoT Hub with the AzIotSdkTest module of Azure/iot-sdks-e2e-fx (pinned to 72c8b95) with local authentication disabled. Device telemetry and twin change events are routed to an Event Hub that accepts only Microsoft Entra ID, since the built-in Event Hub-compatible endpoint takes only shared access keys. The iothub_e2e tests and sdklab tools reach the hub and that Event Hub with a token credential instead of connection strings: in Azure Pipelines, AzurePipelinesCredential for the task's service connection, which keeps issuing tokens for the whole run; elsewhere, DefaultAzureCredential. The tests read IOTHUB_E2E_IOTHUB_HOSTNAME, IOTHUB_E2E_EVENTHUB_FULLY_QUALIFIED_NAMESPACE, IOTHUB_E2E_EVENTHUB_NAME and IOTHUB_E2E_EVENTHUB_CONSUMER_GROUP. Devices still use their own keys.
Contributor
Author
|
/azp run Python E2E |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
Missing Azure E2E and full-duration Windows nightly results leave federation, RBAC, routed telemetry/twin delivery, and token renewal beyond one hour unverified.
No open issues 🎉
What changed in this PR
Migrates Python E2E and nightly service-side authentication to Microsoft Entra ID, using per-run resources with local authentication disabled. Device SAS authentication remains unchanged.
Changes:
- Shares provisioning and test-running templates across both pipelines.
- Uses token credentials for IoT Hub service operations and a dedicated Event Hub for telemetry and twin changes.
- Updates test helpers, sdklab tools, environment settings, and dependencies.
| File | Description |
|---|---|
| vsts/templates/steps-run-iothub-e2e-tests.yaml | Runs tests with service-connection authentication after a role-propagation wait. |
| vsts/templates/steps-create-iothub-e2e-resources.yaml | Provisions resources and routes with local authentication disabled. |
| vsts/python-nightly.yaml | Adopts shared templates and endpoint variables. |
| vsts/python-e2e.yaml | Adopts shared templates for Windows and Linux. |
| uv.lock | Locks Azure Identity and supporting dependencies. |
| tests/e2e/iothub_e2e/sync/conftest.py | Passes token credentials to synchronous fixtures. |
| tests/e2e/iothub_e2e/device_identity_helper.py | Uses token authentication for device management. |
| tests/e2e/iothub_e2e/aio/conftest.py | Passes token credentials to asynchronous fixtures. |
| sdklab/simple_stress/simple_send_message_bulk.py | Updates stress-tool service authentication. |
| sdklab/fuzzing/fuzz_send_message.py | Updates fuzzing-tool service authentication. |
| pyproject.toml | Adds Azure Identity to E2E dependencies. |
| dev_utils/dev_utils/test_env.py | Reads endpoint settings instead of service connection strings. |
| dev_utils/dev_utils/service_helper.py | Forwards endpoints and credentials to the synchronous helper. |
| dev_utils/dev_utils/service_helper_sync.py | Creates token-authenticated service clients. |
| dev_utils/dev_utils/service_credential.py | Selects and caches pipeline or default Azure credentials. |
Review effort: Balanced
The provisioning e2e tests read and delete the devices DPS registers with azure-iot-hub's IoTHubRegistryManager and a Microsoft Entra ID token credential (dev_utils.service_credential) instead of the hub connection string. The pipeline creates the hub and DPS with AzIotSdkTest New-AzIotTestEnvironment -DisableLocalAuth, which links DPS to the hub with its system-assigned identity. Removes the vendored iothubservice20180630 client, now unused. DPS keeps its own shared access policy for enrollments.
Same commit as before (72c8b95).
msrest waits 100 seconds by default, so a request the hub leaves unanswered outlasts the test timeout. A read that times out is retried by msrest.
Carter Tinney (cartertinney)
approved these changes
Dec 3, 2026
…cal-auth # Conflicts: # tests/e2e/provisioning_e2e/service_helper.py
Carter Tinney (cartertinney)
approved these changes
Dec 4, 2026
Ewerton Scaboro da Silva (ewertons)
deleted the
python-e2e-disable-local-auth
branch
December 4, 2026 17:49
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.
Change
Python E2E(vsts/python-e2e.yaml),python-nightly(vsts/python-nightly.yaml) andAzure.azure-iot-sdk-python-dps-e2e(vsts/dps-e2e.yaml) now create their per-run IoT Hub with local authentication disabled, so they no longer use IoT Hub or Event Hub connection strings.vsts/templates/steps-create-iothub-e2e-resources.yaml):New-AzIotTestEnvironment -NoDps -DisableLocalAuth -RouteTelemetryToEventHubfrom the AzIotSdkTest module of Azure/iot-sdks-e2e-fx, pinned to commitc8c4e99e8dd99b8fe47896f833f49d1fee7747a8(AzIotSdkTest 1.11.1; a full SHA, as tags are mutable). The built-in Event Hub-compatible endpoint takes only shared access keys, so device telemetry goes to an Event Hub with local auth disabled (consumer groupscg1..cgN, one per parallel job). Atwin-change-eventsroute now targets that Event Hub. The module grants the service connection IoT Hub Data Contributor and Azure Event Hubs Data Receiver.vsts/templates/steps-run-iothub-e2e-tests.yaml): pytest runs in an AzureCLI@2 task. It waits until the Event Hub role assignments apply, then readsIOTHUB_E2E_IOTHUB_HOSTNAME,IOTHUB_E2E_EVENTHUB_FULLY_QUALIFIED_NAMESPACE,IOTHUB_E2E_EVENTHUB_NAMEandIOTHUB_E2E_EVENTHUB_CONSUMER_GROUP.dev_utils/service_credential.py):AzurePipelinesCredentialfor the task's service connection. It refreshes tokens, so legs that outlast one access token are covered.DefaultAzureCredential.ServiceHelper/ServiceHelperSync,device_identity_helperand the sdklab tools use it throughIoTHubRegistryManager.from_token_credentialandEventHubConsumerClient(fully_qualified_namespace=..., credential=...).New-AzIotTestEnvironment -DisableLocalAuth, which links DPS to the hub with its system-assigned identity. The provisioning tests check and delete registered devices withIoTHubRegistryManager.from_token_credential(readsIOTHUB_E2E_IOTHUB_HOSTNAME). Registry requests time out after 10 seconds instead of msrest's 100, so a read the hub leaves unanswered is retried by msrest rather than outlasting the test timeout. The vendorediothubservice20180630client is removed. DPS keeps its shared access policy:provisioningserviceclientcreates enrollments with the DPS connection string.e2egroup:azure-identity>=1.17.0.Python Canary(vsts/python-canary.yaml) still passesIOTHUB_CONNECTION_STRING/EVENTHUB_CONNECTION_STRINGfor a shared hub, whichtest_envno longer reads. That definition is disabled, and re-enabling it needs its hub set up the same way.Validation