Read Secrets
The Read Secrets action retrieves sensitive values from GitHub Secrets or Azure Key Vault and makes them available to AL-Go workflows. It handles secret encoding, encryption, and masking to ensure secure handling of sensitive data.Overview
This action provides secure secret management for AL-Go workflows by:- Retrieving secrets from GitHub Secrets or Azure Key Vault
- Resolving dependency secrets from AppDependencyProbingPaths and TrustedNuGetFeeds
- Base64 encoding all secrets to handle national characters safely
- Optionally encrypting secrets (when prefixed with
*) - Masking secret values in workflow logs
- Providing authentication tokens for repository operations
Inputs
The shell in which to run the PowerShell script:
powershell- Windows PowerShell 5.1pwsh- PowerShell 7+
All GitHub Secrets in compressed JSON format. Typically passed using
${{ toJson(secrets) }} to include all available secrets from the repository.Comma-separated list of secrets to retrieve. This parameter supports several special values and modifiers:
- Standard secret names: Any GitHub secret name
appDependencySecrets: Automatically retrieves all secrets needed for resolving dependencies in AppDependencyProbingPaths and TrustedNuGetFeedsTokenForPush: Requests a token for making commits and creating pull requests*SecretName: Prefix with asterisk to return the secret encrypted and Base64 encoded
"licenseFileUrl,*CodeSignCertificate,appDependencySecrets,TokenForPush"Determines whether to use the
GhTokenWorkflow secret for the TokenForPush output. When false, the standard GITHUB_TOKEN is used. Set to true to use a custom GitHub token with elevated permissions.Outputs
A compressed JSON structure containing all requested secrets. Each secret value is Base64 encoded. Secrets whose names were preceded by an asterisk (
*) are encrypted before Base64 encoding.Both the original secret value and its Base64 encoded form are automatically masked in workflow logs.The authentication token to use when workflows need to push changes to the repository, either directly or via pull requests. This is either:
- The standard
GITHUB_TOKEN(default) - The
GhTokenWorkflowsecret (whenuseGhTokenWorkflowForPushistrue)
Prerequisites
Before using Read Secrets, you must first call the
ReadSettings action to populate the env.Settings variable. Read Secrets depends on settings to locate Azure Key Vault configuration and dependency paths.Usage Examples
Basic Usage
With Encrypted Secrets
Including Dependency Secrets
Using Custom Token for Push
Complete Workflow Example
Secret Sources
The Read Secrets action can retrieve secrets from two sources:GitHub Secrets
Secrets defined in your repository or organization settings are accessed directly through thegitHubSecrets parameter. These are the primary source for most secrets.
Azure Key Vault
If your AL-Go settings include Key Vault configuration, the action can retrieve secrets from Azure Key Vault. Configure Key Vault in your settings:Common Secrets
Here are commonly used secrets in AL-Go workflows:Build and Signing Secrets
licenseFileUrl: URL to the Business Central license file (required for most builds)CodeSignCertificate: Code signing certificate for signing appsCodeSignCertificatePassword: Password for the code signing certificateInsiderSasToken: SAS token for accessing insider artifacts
Azure Key Vault Secrets
keyVaultName: Name of the Azure Key VaultkeyVaultClientId: Client ID for Key Vault authenticationkeyVaultCertificateUrl: URL to the Key Vault certificatekeyVaultCertificatePassword: Password for the Key Vault certificate
Deployment Secrets
AuthContext: Authentication context for Business Central environmentsEnvironmentName: Target environment name
Repository Secrets
GhTokenWorkflow: Custom GitHub token with elevated permissionsgitHubPackagesContext: Authentication context for GitHub Packages
Dependency Secrets
When you specifyappDependencySecrets in the getSecrets parameter, the action automatically:
- Reads your
AppDependencyProbingPathsfrom settings - Reads your
TrustedNuGetFeedsfrom settings - Extracts the
authTokenSecretfrom each path/feed - Retrieves all referenced authentication secrets
Security Considerations
Encrypted Secrets
Secrets prefixed with* receive additional encryption before Base64 encoding. Use this for highly sensitive values like:
- Code signing certificates
- Private keys
- Certificate passwords
Accessing Secrets in Subsequent Steps
Using the Secrets Output
Using TokenForPush
Troubleshooting
Secret Not Found
If a requested secret is not found:- Verify the secret exists in GitHub repository/organization secrets
- Check the secret name spelling
- Ensure you have access to organization secrets (if applicable)
- For Key Vault secrets, verify Key Vault configuration in settings
Key Vault Access Issues
If Azure Key Vault secrets cannot be retrieved:- Verify
keyVaultNamein settings is correct - Ensure Key Vault authentication secrets are provided
- Check that the service principal has access to the Key Vault
- Verify the Key Vault certificate is valid and not expired
Token Permission Issues
IfTokenForPush doesn’t have sufficient permissions:
- Consider setting
useGhTokenWorkflowForPush: true - Ensure
GhTokenWorkflowsecret is configured with a PAT - Verify the PAT has required permissions (repo, workflow, etc.)
- Check token expiration date
Related Actions
- Read Settings - Required prerequisite
- Run Pipeline - Uses secrets from this action