Prerequisites
Before registering a sandbox environment, ensure you have:- A GitHub repository with AL-Go for GitHub configured
- A Microsoft Entra application registration with client credentials
- An online Business Central sandbox environment (e.g., “QA”)
- S2S authentication configured for your environment (setup instructions)
- Completed the “Add a test app to an existing project” scenario
For access to environments, environment secrets, and deployment branches in private or internal repositories, you must use GitHub Pro, GitHub Team, or GitHub Enterprise.If you’re using a free GitHub account, you can use the environments setting and a secret named
<EnvironmentName>_AuthContext instead of GitHub environments and environment secrets.Setting Up Your Sandbox Environment
Create GitHub Environment
Navigate to your repository on GitHub and configure the environment:
- Open Settings in your repository
- Select Environments from the sidebar
- Click New Environment
- Enter the name of your Business Central environment (e.g., “QA”)
- Choose Configure environment
Configure Authentication Secret
Create the authentication secret for your sandbox environment:Replace the placeholders:
- Under Environment secrets, click Add environment secret
- Set the secret name to
AUTHCONTEXT - Enter a compressed JSON construct with your authentication details:
<TenantID>: Your Microsoft Entra tenant ID where the environment is hosted<ClientID>: The application (client) ID from your Microsoft Entra app registration<ClientSecret>: The client secret value from your app registration
Deploy to Sandbox Environment
Trigger a deployment to your sandbox environment:
- Navigate to Actions in your repository
- Select the Publish To Environment workflow
- Click Run workflow
- Configure the deployment:
- App version: Enter
latest(orcurrentfor released versions) - Environment to receive the new version: Enter your environment name or keep
*for all environments
- App version: Enter
- Click Run workflow
The default app version is
current, which refers to the latest release. If you haven’t created a release yet, use latest to deploy the most recent build artifacts.Environment Configuration Options
Continuous Deployment
By default, sandbox environments support continuous deployment from your CI/CD pipeline. Every successful build on specified branches will automatically deploy to your sandbox.Environment Name Mapping
If your Business Central environment name contains spaces or special characters, map your GitHub environment name to your Business Central environment name:Deployment Branch Protection
Control which branches can deploy to your sandbox environment:Authentication Methods
Service-to-Service (S2S) Authentication
S2S authentication uses Microsoft Entra application credentials for secure, automated deployments. This is the recommended method for production use. Setup requirements:- Microsoft Entra app registration
- API permissions configured for Business Central
- Client secret generated
- App registration added to Business Central environment
Alternative: GitHub Environments Setting
For free GitHub accounts without access to GitHub Environments, use theenvironments setting in your AL-Go settings:
QA_AUTHCONTEXT with the same JSON format.
Troubleshooting
Authentication Failures
Symptoms: 401 Unauthorized errors during deploymentSolutions:
- Verify the client secret hasn’t expired
- Check that the app registration has proper API permissions
- Ensure the JSON secret is properly compressed (no newlines)
- Confirm the TenantID, ClientID, and ClientSecret are correct
Environment Not Found
Symptoms: Environment name not recognized during deploymentSolutions:
- Verify the environment name matches exactly (case-sensitive)
- Check that the environment exists in your Business Central tenant
- Use the
EnvironmentNamemapping if the name contains special characters - Ensure the environment is properly configured for S2S authentication
Deployment Hangs or Times Out
Symptoms: Workflow runs for extended periods without completingSolutions:
- Check Business Central service health
- Verify network connectivity between GitHub and your BC environment
- Review environment capacity and performance
- Check for conflicts with other deployments
App Version Errors
Symptoms: “App version not found” errorsSolutions:
- Use
latestfor unreleased builds - Use
currentfor the latest release - Verify that a release has been created if using
current - Check artifact availability in workflow runs
Best Practices
Use Separate Environments
Maintain distinct environments for different stages:
- DEV: Active development and testing
- QA: Quality assurance and user acceptance testing
- UAT: Pre-production validation
Implement Branch Strategies
Configure different branches for different environments:
developbranch → DEV environmentmainbranch → QA environmentrelease/*branches → UAT environment
Rotate Secrets Regularly
Security best practices:
- Rotate client secrets every 90 days
- Use Azure Key Vault for centralized secret management
- Monitor secret expiration dates
- Implement automated secret rotation where possible
Next Steps
Production Environment
Learn how to configure production environments for manual deployment
Continuous Deployment
Explore advanced continuous deployment configurations
Delivery Targets
Set up NuGet feeds and package delivery
Create a Release
Learn how to create releases for production deployment