STW Services

Introduction:

While Microsoft’s built-in 28-day backup is helpful for short-term recovery, many organizations require longer retention, audit compliance, or the ability to manually restore data at any point in the future.

In this blog, we’ll walk through how to implement a custom backup strategy using PowerShell, Azure Blob Storage, and Automation to create daily BACPAC exports of your Business Central database, extending your DR capability beyond 28 days.

Why Go Beyond 28 Days?

  • Regulatory compliance (GST, audit, tax)
  • Long-term recordkeeping
  • Ability to restore historic data for reporting/testing
  • Business continuity planning

Tools You’ll Use:

ToolPurpose
PowerShell + BC Admin APITrigger export of BACPAC
Azure Storage (Blob)Store backups securely
Azure AutomationSchedule daily exports
SSMSView or restore BACPAC if needed

Step-by-Step: Automate Daily Full BACPAC Backup

1. Set Permissions

  • Assign yourself the role: Business Central Administrator
  • Add D365 BACKUP/RESTORE permission set in BC

2. Create Azure Blob Storage

  • Set up Blob container (e.g., bc-daily-backups)
  • Generate a SAS token or use Key Vault

3. Write PowerShell Script

$envName = “Production” $bacpacName = “Backup_$(Get-Date -Format yyyyMMdd).bacpac” $storageUrl = “https://yourblob.blob.core.windows.net/backups/$bacpacName?{SAS_TOKEN}”

$token = Get-BCAdminToken

Invoke-RestMethod -Method Post -Uri “https://api.businesscentral.dynamics.com/admin/v2.11/applications/businesscentral/environments/$envName/databaseExport” -Headers @{ “Authorization” = “Bearer $token” } ` -Body (@{ “storageAccountUrl” = $storageUrl } | ConvertTo-Json)

4. Schedule in Azure Automation

  • Create a Runbook
  • Securely store token and keys
  • Trigger backup daily at 2 AM or off-peak hours

How to Check or Restore Data

  1. Download .bacpac from Blob
  2. Use SQL Server Management Studio (SSMS)
  3. Right-click on Databases → Import Data-tier Application
  4. Review table data using SQL queries

Bonus: Optional Restore for Testing

  • Restore BACPAC to Azure SQL or local server
  • Use for:
    • Training environments
    • Testing integrations
    • Backup validation

Conclusion:

For advanced disaster recovery, regulatory compliance, and peace of mind, implementing a custom BACPAC export pipeline allows you to retain control of your Business Central data, beyond Microsoft’s default limitations. It’s an essential best practice for mature businesses relying on ERP continuity.