Skip to content

[v5] Remove usage of ID Labs API in msal-node tests#8319

Open
Avery-Dunn wants to merge 6 commits intodevfrom
avdunn/node-test-refactor
Open

[v5] Remove usage of ID Labs API in msal-node tests#8319
Avery-Dunn wants to merge 6 commits intodevfrom
avdunn/node-test-refactor

Conversation

@Avery-Dunn
Copy link
Contributor

@Avery-Dunn Avery-Dunn commented Feb 10, 2026

This PR makes similar changes to what is being done in other MSALs:
AzureAD/microsoft-authentication-library-for-java#1002
AzureAD/microsoft-authentication-library-for-dotnet#5631
AzureAD/microsoft-authentication-library-for-go#593
AzureAD/microsoft-authentication-library-for-python#870

Historically, integration tests in MSAL and MISE retrieved user/app/tenant/etc. info from our API at "https://msidlab.com/api/"

That API is being deprecated in favor of a key vault-based system: instead of dynamic config based on query parameters, we have a simpler set of config stored as key vault secrets.

This PR refactors the integration tests to retrieve the config they need from those key vaults instead of the API, and makes the following changes:

  • e2eTestUtils : A few new helper classes were added to the existing utility module, existing behavior was not changed
  • msal-node integration tests: Essentially every test that referenced LabClient was adjusted to use the new helpers

Test coverage and core behavior of the tests was not changed: they simply retrieve the config they need from a different set of helpers.

@Avery-Dunn Avery-Dunn marked this pull request as ready for review February 11, 2026 17:20
@Avery-Dunn Avery-Dunn requested review from a team as code owners February 11, 2026 17:20
Copilot AI review requested due to automatic review settings February 11, 2026 17:20
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the msal-node sample E2E/integration tests to stop using the deprecated https://msidlab.com/api/ (via LabClient) and instead pull lab user/app configuration from Azure Key Vault via new helpers in samples/e2eTestUtils.

Changes:

  • Added Key Vault-backed configuration helpers (LabResponseHelper, KeyVaultSecretsProvider, KeyVaultSecrets, LabUser, AppConfig/UserConfig) to e2eTestUtils.
  • Updated msal-node sample integration tests to use LabResponseHelper.getLabUser(...), getAppConfig(...), and LabUser.getPassword() instead of LabClient + setupCredentials.
  • Updated client-credentials tests to use certificate-based auth material loaded via the new helpers.

Reviewed changes

Copilot reviewed 26 out of 27 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
samples/msal-node-samples/silent-flow/test/silent-flow-b2c-local.spec.ts Switches B2C local silent-flow test to Key Vault lab user retrieval.
samples/msal-node-samples/silent-flow/test/silent-flow-b2c-aad.spec.ts Switches B2C(AAD) silent-flow test to Key Vault lab user retrieval.
samples/msal-node-samples/silent-flow/test/silent-flow-adfs.spec.ts Switches ADFS silent-flow test to Key Vault lab user retrieval.
samples/msal-node-samples/silent-flow/test/silent-flow-aad.spec.ts Switches AAD silent-flow test to Key Vault lab user retrieval.
samples/msal-node-samples/silent-flow/test/silent-flow-aad-agc-public.spec.ts Switches AGC public-cloud silent-flow test to Key Vault user/app config.
samples/msal-node-samples/silent-flow/test/silent-flow-aad-agc-confidential.spec.ts Switches AGC confidential silent-flow test to Key Vault user/app config + secret retrieval.
samples/msal-node-samples/on-behalf-of/test/obo-aad.spec.ts Switches OBO test to Key Vault lab user retrieval.
samples/msal-node-samples/device-code/test/device-code-adfs.spec.ts Switches ADFS device-code test to Key Vault lab user retrieval.
samples/msal-node-samples/device-code/test/device-code-aad.spec.ts Switches AAD device-code test to Key Vault lab user retrieval.
samples/msal-node-samples/device-code/test/device-code-aad-agc.spec.ts Switches AGC device-code test to Key Vault user/app config.
samples/msal-node-samples/client-credentials/test/client-credentials-aad.spec.ts Switches client-credentials test to Key Vault app config + certificate material helper.
samples/msal-node-samples/b2c-user-flows/test/user-flows-local.spec.ts Switches B2C user-flows test to Key Vault user + secret retrieval.
samples/msal-node-samples/auth-code/test/auth-code-b2c-local.spec.ts Switches B2C local auth-code test to Key Vault lab user retrieval.
samples/msal-node-samples/auth-code/test/auth-code-b2c-aad.spec.ts Switches B2C(AAD) auth-code test to Key Vault lab user retrieval.
samples/msal-node-samples/auth-code/test/auth-code-adfs.spec.ts Switches ADFS auth-code test to Key Vault lab user retrieval.
samples/msal-node-samples/auth-code/test/auth-code-aad.spec.ts Switches AAD auth-code test to Key Vault lab user retrieval.
samples/msal-node-samples/auth-code/test/auth-code-aad-agc-public.spec.ts Switches AGC public auth-code test to Key Vault user/app config.
samples/msal-node-samples/auth-code/test/auth-code-aad-agc-confidential.spec.ts Switches AGC confidential auth-code test to Key Vault user/app config + secret retrieval.
samples/msal-node-samples/auth-code-cli-app/test/auth-code-cli.spec.ts Switches auth-code CLI test to Key Vault lab user retrieval.
samples/msal-node-samples/ElectronSystemBrowserTestApp/tests/electron-code-aad.spec.ts Switches Electron system-browser test to Key Vault lab user retrieval.
samples/e2eTestUtils/src/index.ts Re-exports new Key Vault config helpers/types from the e2e utils package.
samples/e2eTestUtils/src/UserConfig.ts Adds UserConfig and LabUser (password fetch + caching).
samples/e2eTestUtils/src/LabResponseHelper.ts Adds cached Key Vault retrieval/parsing for user/app configs and secrets.
samples/e2eTestUtils/src/KeyVaultSecretsProvider.ts Adds certificate-based Key Vault access + lab credential extraction/cache.
samples/e2eTestUtils/src/KeyVaultSecrets.ts Adds strongly-typed Key Vault secret name constants.
samples/e2eTestUtils/src/AppConfig.ts Adds AppConfig type for app configuration stored in Key Vault secrets.

@Avery-Dunn Avery-Dunn changed the title Remove usage of ID Labs API in msal-node tests [v5] Remove usage of ID Labs API in msal-node tests Feb 11, 2026
RyAuld
RyAuld previously approved these changes Feb 20, 2026
const envResponse = await labClient.getVarsByCloudEnvironment(
labApiParms
);
[username, accountPwd] = await setupCredentials(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why didn't we just update the underlying implementation of this function? Wouldn't that have resulted in fewer changes?

LabCertificateCredential,
} from "e2e-test-utils";
import { ConfidentialClientApplication } from "@azure/msal-node";
import config from "../config/AAD.json";
Copy link
Collaborator

Choose a reason for hiding this comment

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

What's going on here? This looks unrelated?


// Load scenario configuration
const config = require("../config/AAD-AGC.json");
config.authOptions = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same question here, why is this changing?

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.

4 participants