Overview
Code signing is a critical security practice that ensures the authenticity and integrity of your Business Central apps. As of June 1st, 2023, industry standards require code signing certificates to be stored on Hardware Security Modules (HSM) or FIPS 140-2 Level 2 certified hardware tokens. AL-Go for GitHub uses Azure Key Vault to securely store code signing certificates and .NET Sign to sign application files.This guide assumes you have already set up your AL-Go project with Azure Key Vault for secrets management. If you haven’t, first follow the Use Azure KeyVault for secrets with AL-Go scenario.
Why Azure Key Vault?
Since June 1st, 2023, Certificate Authorities issue code signing certificates only through:- Physical USB tokens
- On-premises HSM services
- Cloud HSM services (such as Azure Key Vault)
- FIPS 140-2 Level 2 compliance: Premium SKU supports HSM-backed certificates
- Cloud accessibility: Sign code from GitHub Actions without physical tokens
- Certificate lifecycle management: Automated renewal and rotation
- Access control: Fine-grained permissions via RBAC or vault policies
- Audit logging: Track all certificate usage
Prerequisites
Azure Subscription
An active Azure subscription with permissions to create Key Vaults and manage certificates.
AL-Go Repository
A GitHub repository configured with AL-Go for GitHub (preferably the AppSource template).
Azure Key Vault Setup
Complete the Azure Key Vault setup for AL-Go by following the Use Azure KeyVault scenario.
Azure Key Vault Setup
Create or Configure Key Vault
If you don’t already have a Key Vault, create one:Most certificates issued after June 1st, 2023 require Premium SKU for HSM support. Check with your Certificate Authority if unsure.
Import Certificate to Key Vault
How you import your certificate depends on your Certificate Authority (CA):Option 1: Direct Integration (DigiCert, GlobalSign)
DigiCert and GlobalSign offer direct integration with Azure Key Vault:Set Up CA Integration
Follow Microsoft’s guide to integrate your Certificate Authority with Azure Key Vault.
Option 2: CSR-Based Import (Other CAs)
For other Certificate Authorities:
See Generate CSR and Install Certificate in Azure Key Vault for detailed instructions.
Option 3: Import Existing Certificate
If you have an existing PFX certificate file:Access Control Configuration
AL-Go needs permission to access your certificate for signing operations. Azure Key Vault supports two security models:Option 1: Role-Based Access Control (RBAC) - Recommended
Grant your Service Principal or Managed Identity the following roles:
Using Azure CLI:
Option 2: Vault Access Policy
For Key Vaults using the Access Policy security model:Add Access Policy
Click Add Access Policy and configure:Certificate permissions:
- Get
- Sign
Microsoft recommends using RBAC over Access Policies for new Key Vaults. RBAC provides more granular control and better integration with Azure governance.
AL-Go Configuration
Once your Key Vault and certificate are configured, enable code signing in AL-Go.Configure Code Signing Settings
Update your AL-Go settings file (.AL-Go/settings.json or project-specific settings) with the certificate name:
| Setting | Required | Description |
|---|---|---|
keyVaultCodesignCertificateName | Yes | Name of your code signing certificate in Azure Key Vault |
The certificate name must match exactly (case-sensitive) with the certificate name in your Azure Key Vault.
Complete Configuration Example
For an AppSource app with code signing:Verification
After configuration, verify that code signing works correctly:Trigger CI/CD Workflow
Push a change to trigger the CI/CD workflow, or manually run the workflow from the Actions tab.
Monitor Build Process
In the workflow logs, look for the signing step. You should see messages indicating:
- Connection to Azure Key Vault
- Certificate retrieval
- Signing operation for each .app file
Download Build Artifacts
After the workflow completes, download the build artifacts from the workflow summary.
Expected Output
Successful signing shows:Code Signing Process
When AL-Go builds your apps with code signing enabled, the following process occurs:Authenticate to Azure
Using the
AZURE_CREDENTIALS secret, AL-Go authenticates to your Azure subscription.Retrieve Certificate
The code signing certificate is retrieved from Key Vault (certificate never leaves Azure).
Timestamp Signatures
A trusted timestamp authority timestamp is added, ensuring signatures remain valid after certificate expiration.
The private key never leaves Azure Key Vault. Signing operations are performed within the Key Vault’s secure environment, and only the signed output is returned.
Troubleshooting
Certificate Not Found
Symptom: Error indicating certificate cannot be found in Key Vault Solutions:- Verify
keyVaultCodesignCertificateNamematches the certificate name exactly (case-sensitive) - Check that the certificate exists in your Key Vault using Azure Portal or CLI
- Ensure you’re referencing the correct Key Vault in your
AZURE_CREDENTIALSsecret
Access Denied Errors
Symptom: Permission errors when trying to access Key Vault or certificate Solutions:- Verify your Service Principal has the required roles (RBAC) or permissions (Access Policy)
- Check that the
AZURE_CREDENTIALSsecret contains the correct Service Principal credentials - Ensure the Service Principal is not disabled or expired
- Verify the Key Vault firewall allows access from GitHub Actions
Invalid Signature
Symptom: Signature verification fails or shows as invalid Solutions:- Ensure your certificate is valid (not expired)
- Verify the certificate is issued by a trusted Certificate Authority
- Check that timestamp servers are accessible during signing
- For AppSource, ensure certificate meets Microsoft’s code signing requirements
Premium SKU Required
Symptom: Error about HSM-backed certificates on Standard SKU Solutions:- If your certificate requires HSM support, upgrade to Premium SKU:
- Or obtain a software-protected certificate compatible with Standard SKU
Network Connectivity Issues
Symptom: Timeout or connection errors to Key Vault Solutions:- Check Key Vault firewall settings
- Ensure Key Vault allows access from GitHub Actions IP ranges
- Consider enabling “Allow trusted Microsoft services” in Key Vault networking
Security Best Practices
Use Premium SKU
For production AppSource apps, use Premium SKU Key Vaults with HSM-backed certificates for maximum security.
Rotate Certificates
Plan for certificate renewal before expiration. Azure Key Vault supports automatic renewal with integrated CAs.
Limit Access
Grant minimum required permissions. Use RBAC with specific roles rather than broad access policies.
Monitor Access
Enable Azure Key Vault logging and monitoring to track certificate access and signing operations.
Secure Service Principal
Store
AZURE_CREDENTIALS as a GitHub secret. Never commit credentials to your repository.Use Managed Identity
Where possible, use Managed Identity instead of Service Principal for enhanced security and simpler credential management.
Certificate Lifecycle Management
Certificate Renewal
Plan for certificate renewal before expiration:Monitor Expiration
Set up Azure Monitor alerts for certificate expiration (recommend 60 days before expiry).
Renew Certificate
For integrated CAs (DigiCert, GlobalSign), Azure Key Vault can automatically renew certificates. For others, manually renew through your CA.
Certificate Revocation
If your certificate is compromised:- Immediately revoke the certificate through your Certificate Authority
- Disable the certificate in Key Vault
- Request a new certificate from your CA
- Update Key Vault with the new certificate
- Re-sign and republish all previously signed apps if required
Cost Considerations
Azure Key Vault pricing includes:- Key Vault: Monthly charge per vault (Standard or Premium SKU)
- Certificate operations: Per-operation charges for certificate requests
- Cryptographic operations: Per-operation charges for signing operations
- Storage: Certificate storage (minimal cost)
Premium SKU is more expensive than Standard, but required for HSM-backed certificates. Evaluate your security requirements against budget constraints.
Next Steps
Publish to AppSource
Configure the AppSource publishing workflow to deliver your signed apps
AppSource Overview
Learn more about AppSource publishing concepts and requirements