Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
7452ae7
Initial plan
Copilot Mar 13, 2026
68ab53d
Add Key Vault underscore warning and document AUTHCONTEXT secret reso…
Copilot Mar 13, 2026
454ccba
Remove incorrect GitHub Environment secret scope notes; auth check in…
Copilot Mar 20, 2026
ff2d8cd
Merge branch 'main' into copilot/fix-authcontext-secret-resolution
spetersenms Apr 7, 2026
a6dcd29
Fix mdformat violations and remove incorrect RegisterProductionEnviro…
Copilot Apr 7, 2026
194abf6
Merge branch 'main' into copilot/fix-authcontext-secret-resolution
spetersenms Apr 30, 2026
c75a13f
Use OutputWarning from DebugLogHelper instead of manual Write-Host wa…
Copilot Apr 30, 2026
6385a0c
Merge branch 'main' into copilot/fix-authcontext-secret-resolution
mazhelez Jul 13, 2026
f14f2c3
Merge branch 'main' into copilot/fix-authcontext-secret-resolution
spetersenms Jul 30, 2026
3bf917f
Clarify AuthContext Key Vault naming guidance
Copilot Jul 30, 2026
2ae21b5
Remove accidental testResults.xml from branch
Copilot Jul 30, 2026
2568867
Merge branch 'main' into copilot/fix-authcontext-secret-resolution
spetersenms Jul 31, 2026
e6def6a
Remove testResults.xml from tracking and add to .gitignore
Copilot Jul 31, 2026
e6c8513
Revert unrelated .gitignore change (testResults.xml)
Copilot Aug 6, 2026
d0c1fd7
Merge branch 'main' into copilot/fix-authcontext-secret-resolution
spetersenms Aug 7, 2026
94db503
Merge branch 'main' into copilot/fix-authcontext-secret-resolution
spetersenms Aug 7, 2026
1101882
Merge branch 'main' into copilot/fix-authcontext-secret-resolution
aholstrup1 Aug 7, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Actions/ReadSecrets/ReadSecretsHelper.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ function GetKeyVaultSecret {
}
if ($secret.Contains('_')) {
# Secret name contains a '_', which is not allowed in Key Vault secret names
OutputWarning "Secret name '$secret' contains an underscore ('_'), which is not supported in Azure Key Vault. The Key Vault lookup will be skipped for this secret. Consider using a dash ('-') instead (e.g., '$($secret.Replace('_','-'))') when storing secrets in Azure Key Vault."
Comment thread
spetersenms marked this conversation as resolved.
Outdated
return $null
}

Expand Down
22 changes: 20 additions & 2 deletions Scenarios/secrets.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ If your GitHub organization might have many organizational secrets, please only
The following is a list of secrets and a brief description:

- [Azure_Credentials](#Azure_Credentials) - Connect to Azure
- [AuthContext or \<EnvironmentName>\_AuthContext](#AuthContext) - Deploy to an environment
- [AuthContext, \<EnvironmentName>-AuthContext, or \<EnvironmentName>\_AuthContext](#AuthContext) - Deploy to an environment
- [AppSourceContext](#AppSourceContext) - Deliver to AppSource
- [StorageContext](#StorageContext) - Deliver to storage
- [GitHubPackagesContext](#GitHubPackagesContext) - Deliver to GitHub Packages
Expand Down Expand Up @@ -107,7 +107,25 @@ With this setup, you can create a setting called `keyVaultCodesignCertificateNam

## **AuthContext** -> Deploy to an environment

Whenever AL-Go for GitHub is doing to deploy to an environment, it will need an AuthContext secret. The AuthContext secret can be provided underneath the environment in GitHub. If you are using a private repository in the free GitHub plan, you do not have environments. Then you can create an AuthContext secret in the repository. If you have multiple environments, you can create different AuthContext secrets by using the environment name followed by an underscore and AuthContext (f.ex. **QA_AuthContext**).
Whenever AL-Go for GitHub deploys to an environment, it needs an AuthContext secret. AL-Go resolves the AuthContext secret by looking up the following secret names **in order**, using the first one that resolves to a non-empty value:

1. **`<EnvironmentName>-AuthContext`** (dash variant, e.g. `QA-AuthContext`) – checked first
1. **`<EnvironmentName>_AuthContext`** (underscore variant, e.g. `QA_AuthContext`) – checked second
1. **`AuthContext`** (generic fallback) – checked last

> [!IMPORTANT]
> **Azure Key Vault users:** Azure Key Vault does not allow underscores (`_`) in secret names. If Azure Key Vault is configured as your secrets provider, any secret whose name contains an underscore will be **skipped** during Key Vault lookup (a warning will be emitted in the workflow log). This means the underscore variant `<EnvironmentName>_AuthContext` will not be found in Azure Key Vault. Use the **dash variant** `<EnvironmentName>-AuthContext` when storing per-environment AuthContext secrets in Azure Key Vault, as dashes are permitted in Key Vault secret names.
Comment thread
spetersenms marked this conversation as resolved.
Outdated

> [!WARNING]
> **Multi-environment and multi-tenant repos:** If neither `<EnvironmentName>-AuthContext` nor `<EnvironmentName>_AuthContext` resolves to a value, AL-Go **silently falls back** to the generic `AuthContext` secret. The workflow log will only show `Using AuthContext secret as AuthContext` — no warning is emitted that a per-environment secret was expected but not found. In repositories with multiple environments (for example, different customer tenants), this means a missing per-environment secret will cause all environments to deploy using the same shared credentials, which may not be the intended behavior. Ensure all environments that require credential isolation have a per-environment `<EnvironmentName>-AuthContext` or `<EnvironmentName>_AuthContext` secret defined.

The AuthContext secret can be provided in the following ways:

- As a **GitHub Environment secret** named `AUTHCONTEXT` under the environment (available in the deploy job when targeting that GitHub Environment)
- As a **repository or organization secret** named `<EnvironmentName>-AuthContext` or `<EnvironmentName>_AuthContext` (recommended for per-environment isolation)
- As a **repository or organization secret** named `AuthContext` (generic fallback for all environments)

If you are using a private repository with the free GitHub plan and do not have access to GitHub Environments, use the per-environment naming convention as a repository secret.

### Managed identity

Expand Down
Loading