Conversation
…lution lookup chain Co-authored-by: spetersenms <79980472+spetersenms@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] [Bug] Fix undocumented AUTHCONTEXT secret resolution issues
docs: Document AUTHCONTEXT secret lookup chain, Key Vault underscore limitation, and GitHub Environment secret scope
Mar 13, 2026
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.
AUTHCONTEXT secret resolution had several undocumented behaviors that caused silent wrong-credential deployments with no log evidence: the dash variant was never mentioned, Key Vault silently dropped underscore secrets, and the generic fallback gave no warning.
Code change
Actions/ReadSecrets/ReadSecretsHelper.psm1: Emit::warning::when a Key Vault lookup is skipped because the secret name contains_. Previously returned$nullwith zero log output.Documentation changes
Scenarios/secrets.md— Rewrote theAuthContextsection to document:{envName}-AuthContext→{envName}_AuthContext→AuthContextAuthContextfallback is silent; in multi-tenant repos this can deploy with the wrong credentialsenvironment:— the Initialization auth-check job does not have this, so environment-scopedAUTHCONTEXTis invisible thereScenarios/RegisterSandboxEnvironment.mdandScenarios/RegisterProductionEnvironment.md— Added notes after the AUTHCONTEXT environment secret setup step clarifying the scope limitation and pointing to the repo-level per-environment naming convention as the alternative.✅ Checklist
Original prompt
This section details on the original issue you should resolve
<issue_title>[Bug]: AUTHCONTEXT secret resolution undocumented -- silent Key Vault underscore failure, undocumented dash variant, silent org-level fallback trap, GitHub Environment secrets invisible at auth-check step</issue_title>
<issue_description>## AL-Go version
v8.2
Describe the issue
There are five related problems with AUTHCONTEXT secret resolution that together create silent wrong-environment deployments with no errors and no warnings. Each problem is individually confusing; together they are a reliability and security hazard in multi-environment and multi-tenant repos. I am documenting all five here as a single issue because fixing any one of them in isolation without fixing the others would still leave users in a broken state.
Finding 1: The full lookup chain is undocumented -- the dash variant is never mentioned
Both
Templates/Per Tenant Extension/.github/workflows/CICD.yaml(line 351) andTemplates/Per Tenant Extension/.github/workflows/PublishToEnvironment.yaml(line 90) declare:The PowerShell resolution logic in
PublishToEnvironment.yamllines 100-106 then evaluates them in this exact order:The dash variant
{envName}-AuthContextis tried first and is the highest-priority lookup. It is never mentioned anywhere in the documentation.Scenarios/secrets.mddocuments only<EnvironmentName>_AuthContext(underscore). A user reading the documentation has no way to know the dash variant exists, let alone that it takes precedence.This matters practically because the dash variant is the only one of the three that works correctly with Azure Key Vault (see Finding 2 below).
Finding 2: Azure Key Vault silently skips all underscore secrets --
{env}_AuthContextsilently returns nullActions/ReadSecrets/ReadSecretsHelper.psm1lines 158-161:When Azure Key Vault is configured as the secrets provider, any requested secret name containing an underscore is immediately returned as
$null. No error is thrown. No warning is written to the log. No indication is given that the lookup was skipped.The consequence: the documented pattern
<EnvironmentName>_AuthContextis silently non-functional when Azure Key Vault is in use. A user who readsScenarios/secrets.md, creates a Key Vault secret namedMY-UAT_AuthContext, and triggers a deployment toMY-UATwill get no error. The workflow log will not mention that the Key Vault lookup was skipped. The workflow silently falls through to the genericAuthContextfallback.The dash variant
{env}-AuthContextdoes work with Key Vault because dashes are permitted in Key Vault secret names. This is never documented.Finding 3: The generic
AuthContextfallback is a silent cross-environment credential trapWhen neither
{env}-AuthContextnor{env}_AuthContextresolves to a value, AL-Go silently falls back to the genericAuthContextsecret. The only log evidence of this is the messageUsing AuthContext secret as AuthContext. There is no warning that this is a fallback, no indication that a per-environment secret was expected but not found, and no indication that the credentials being used may not correspond to the target environment.In organizations that define
AUTHCONTEXTat the org level and share it with all repositories (a common pattern for product repos), every environment in every repo that lacks a per-environment secret will silently deploy using the org-level credential.In a multi-tenant PTE scenario this creates a security isolation failure:
TenantAppsrepo has environmentsCUSTOMER-A-UATandCUSTOMER-B-UATAuthContextsecret definedAUTHCONTEXTbelongs to Customer A's BC service accountPublish To EnvironmenttargetingCUSTOMER-B-UATAUTHCONTEXT(Customer A's credentials) with no warningIn regulated industries where BC tenant isolation is a compliance requirement, this silent fallback is particularly dangerous.
Finding 4: GitHub Environment secrets are invisible at the auth-check initialization step
In both
CICD.yamland...📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.