Skip to content

Commit ae4b5af

Browse files
committed
Mimic MSAL.js: hardcode RequestMSIDLAB client ID in CI stage variables
- Hardcode LAB_APP_CLIENT_ID = f62c5ae3-bf3a-4af5-afa8-a68b800396e9 (RequestMSIDLAB) directly in the CI stage variables block, matching the pattern used by MSAL.js (AZURE_CLIENT_ID in the pipeline YAML) and avoiding the need for a UI-configured pipeline variable. - Remove conditions gating AzureKeyVault@2 and cert-write steps — they now always run (matching MSAL.js install-keyvault-secrets.yml). - Clean up lab certificate unconditionally on always(). - Revert LAB_APP_TENANT_ID from lab_config.py — not needed since RequestMSIDLAB is registered in the Microsoft tenant (the default).
1 parent ef7a76e commit ae4b5af

File tree

2 files changed

+8
-17
lines changed

2 files changed

+8
-17
lines changed

.Pipelines/template-pipeline-stages.yml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,11 @@ stages:
122122
eq(dependencies.PreBuildCheck.result, 'Succeeded'),
123123
in(dependencies.Validate.result, 'Succeeded', 'Skipped')
124124
)
125+
variables:
126+
# RequestMSIDLAB — the MSID Lab confidential client app used for Key Vault
127+
# access and as a test subject. Matches usage in MSAL.js and MSAL Java pipelines.
128+
# See https://docs.msidlab.com/accounts/confidentialclient.html
129+
LAB_APP_CLIENT_ID: 'f62c5ae3-bf3a-4af5-afa8-a68b800396e9'
125130
jobs:
126131
- job: Test
127132
displayName: 'Run unit tests'
@@ -143,11 +148,9 @@ stages:
143148
python.version: '3.14'
144149
steps:
145150
# Retrieve the MSID Lab certificate from Key Vault (via AuthSdkResourceManager SC).
146-
# Gated on LAB_APP_CLIENT_ID being non-empty — if e2e tests are not enabled (the default),
147-
# both steps are skipped and the pipeline has no Key Vault dependency.
151+
# Matches the pattern used by MSAL.js (install-keyvault-secrets.yml) and MSAL Java.
148152
- task: AzureKeyVault@2
149153
displayName: 'Retrieve lab certificate from Key Vault'
150-
condition: and(succeeded(), ne(variables['LAB_APP_CLIENT_ID'], ''))
151154
inputs:
152155
azureSubscription: 'AuthSdkResourceManager'
153156
KeyVaultName: 'msidlabs'
@@ -161,7 +164,6 @@ stages:
161164
echo "##vso[task.setvariable variable=LAB_APP_CLIENT_CERT_PFX_PATH]$CERT_PATH"
162165
echo "Lab cert written to: $CERT_PATH ($(wc -c < "$CERT_PATH") bytes)"
163166
displayName: 'Write lab certificate to disk'
164-
condition: and(succeeded(), ne(variables['LAB_APP_CLIENT_ID'], ''))
165167
166168
- task: UsePythonVersion@0
167169
inputs:
@@ -183,13 +185,7 @@ stages:
183185
pytest -vv --junitxml=test-results/junit.xml 2>&1 | tee test-results/pytest.log
184186
displayName: 'Run tests'
185187
env:
186-
# LAB_APP_CLIENT_ID enables e2e tests against the MSID Lab infrastructure.
187-
# Must be set as a pipeline variable to the lab app's client ID
188-
# (see https://docs.msidlab.com/accounts/confidentialclient.html).
189-
# The matching certificate is retrieved from Key Vault by the steps above.
190-
# When unset, all LabBasedTestCase tests skip gracefully.
191188
LAB_APP_CLIENT_ID: $(LAB_APP_CLIENT_ID)
192-
LAB_APP_TENANT_ID: $(LAB_APP_TENANT_ID)
193189
LAB_APP_CLIENT_CERT_PFX_PATH: $(LAB_APP_CLIENT_CERT_PFX_PATH)
194190
195191
- task: PublishTestResults@2
@@ -203,7 +199,7 @@ stages:
203199

204200
- bash: rm -f "$(Agent.TempDirectory)/lab-auth.pfx"
205201
displayName: 'Clean up lab certificate'
206-
condition: and(always(), ne(variables['LAB_APP_CLIENT_ID'], ''))
202+
condition: always()
207203

208204
# ══════════════════════════════════════════════════════════════════════════════
209205
# Stage 3 · Build — build sdist + wheel (release only)

tests/lab_config.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -194,12 +194,7 @@ def _get_credential():
194194
"""
195195
client_id = _clean_env("LAB_APP_CLIENT_ID")
196196
cert_path = _clean_env("LAB_APP_CLIENT_CERT_PFX_PATH")
197-
# Allow callers to override the tenant via LAB_APP_TENANT_ID.
198-
# Defaults to the Microsoft tenant where the MSID Lab app is registered.
199-
tenant_id = (
200-
_clean_env("LAB_APP_TENANT_ID")
201-
or "72f988bf-86f1-41af-91ab-2d7cd011db47" # Microsoft tenant
202-
)
197+
tenant_id = "72f988bf-86f1-41af-91ab-2d7cd011db47" # Microsoft tenant
203198

204199
if not client_id:
205200
raise EnvironmentError(

0 commit comments

Comments
 (0)