Skip to content

Run PR pipeline on Wilson pool so integration/E2E tests can access lab KeyVault - #3913

Merged
Iarek Kovtunenko (iarekk) merged 1 commit into
masterfrom
iarekk/pipeline-wilson-pool
Jul 2, 2026
Merged

Run PR pipeline on Wilson pool so integration/E2E tests can access lab KeyVault#3913
Iarek Kovtunenko (iarekk) merged 1 commit into
masterfrom
iarekk/pipeline-wilson-pool

Conversation

@iarekk

Copy link
Copy Markdown
Contributor

Problem

After moving the PR pipeline to the Microsoft-hosted windows-2022 pool, unit tests pass but integration tests fail with:

IDW10109: No credential could be loaded ... code isn't running on Azure to be able to use Managed Identity ...
Credential CertificateFromKeyVault=https://msidlabs.vault.azure.net/LabAuth;Thumbprint=null failed:
Azure.Identity.CredentialUnavailableException: DefaultAzureCredential failed to retrieve a token
 - ManagedIdentityCredential ... "Identity not found"

The integration/E2E test host (tests/E2E Tests/IntegrationTestService/appsettings.json) loads its client certificate from the msidlabs KeyVault (SourceType: KeyVault, KeyVaultCertificateName: LabAuth). Microsoft.Identity.Web resolves that via DefaultAzureCredential, which on the ephemeral hosted agent finds no managed identity (IMDS returns Identity not found) and no other credential, so the cert can't be downloaded.

Why the Wilson pool fixes it

The OneBranch Tests job runs on MwWilson1EsHostedPool, whose agent VMs are provisioned with a managed identity that has access to the lab KeyVaults. There is no credential setup in YAML — DefaultAzureCredential transparently uses that managed identity. The hosted pool has no equivalent identity.

Change

  • Revert the PR_build pool from vmImage: windows-2022 back to name: MwWilson1EsHostedPool.
  • Keep the explicit template-build.yaml step and the visualstudio demand so the integration/E2E assemblies are built fresh and VSTest@2 can run (mirrors the OneBranch Wilson Tests job, which demands both msbuild and visualstudio).

Notes

The alternative (staying on hosted agents) would require injecting an Azure credential into the agent (e.g. AzureCLI@2 with addSpnToEnvironment exporting AZURE_CLIENT_ID/TENANT_ID/secret) so DefaultAzureCredential's EnvironmentCredential can reach msidlabs. Going back to the Wilson pool restores the previously-working setup without that complexity.

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

Revert the PR_build pool from the Microsoft-hosted windows-2022 image back to
the MwWilson1EsHostedPool. The integration and E2E tests configure their host
app to load the LabAuth client certificate from the msidlabs KeyVault
(SourceType: KeyVault), which Microsoft.Identity.Web resolves via
DefaultAzureCredential. The ephemeral hosted agents have no managed identity,
so IMDS returns "Identity not found" and cert load fails with IDW10109.

The Wilson pool agents carry a managed identity with access to the lab
KeyVaults (as the OneBranch Tests job relies on), so DefaultAzureCredential
succeeds there. Keep the explicit build step and visualstudio demand so the
integration/E2E test assemblies are built fresh and VSTest can run.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@iarekk
Iarek Kovtunenko (iarekk) requested a review from a team as a code owner July 2, 2026 12:08

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's keep this for now. And see how to move to a new VM. ETA - next week.

@iarekk
Iarek Kovtunenko (iarekk) merged commit 2ca21d8 into master Jul 2, 2026
4 checks passed
@iarekk
Iarek Kovtunenko (iarekk) deleted the iarekk/pipeline-wilson-pool branch July 2, 2026 14:05
@bgavrilMS

Copy link
Copy Markdown
Member

Avery-Dunn - is this ok to do ? I think those Wilson VMs are very overloaded, and if we start to run Id.Web builds it'll be tough

Iarek Kovtunenko (iarekk) added a commit that referenced this pull request Jul 3, 2026
* Revert "Run PR pipeline on Wilson pool for lab KeyVault access (#3913)"

This reverts commit 2ca21d8.

* Load LabAuth cert from store for integration tests on hosted agents

The integration-test host (IntegrationTestService) loads its LabAuth client
certificate from the msidlabs KeyVault, which Microsoft.Identity.Web resolves
via DefaultAzureCredential. Microsoft-hosted agents have no managed identity
with access to that KeyVault, so restore/run fails with IDW10109.

Add an opt-in switch (env var UseLabAuthCertFromStore) that overrides the
client-certificate source for both schemes to load the LabAuth cert from
LocalMachine/My (CN=LabAuth.MSIDLab.com), which the pipeline already installs.
Default (unset) keeps the KeyVault source, so the official OneBranch/Wilson
pipeline and local dev are unchanged. The switch is enabled only in the hosted
GitHub PR pipeline (azure-pipelines.yml).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Jul 3, 2026
This was referenced Jul 28, 2026
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.

3 participants