fix: correct BC Admin Center API endpoints for database export

- Fix endpoint paths from /applications/businesscentral/environments/{env}/databaseExports
  to /exports/applications/BusinessCentral/environments/{env}
- Add Azure Storage SAS URI support (required by current export API)
- Update default API version from v2.15 to v2.21
- Add export metrics check before initiating export
- Use export history endpoint for status polling
- Download BACPAC from Azure Storage instead of expecting blobUri response

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-09 19:21:06 +01:00
parent d35806b8e1
commit 96237787da
3 changed files with 166 additions and 88 deletions

View File

@@ -40,8 +40,28 @@ AZURE_CLIENT_SECRET=""
# Find this in BC Admin Center: https://businesscentral.dynamics.com/
BC_ENVIRONMENT_NAME=""
# BC Admin API version (default: v2.15, adjust if needed)
BC_API_VERSION="v2.15"
# BC Admin API version (default: v2.21)
BC_API_VERSION="v2.21"
# ===================================
# Azure Storage Configuration
# ===================================
# The BC Admin Center API exports the database to your Azure Storage account.
# You need an Azure Storage account with a SAS URI that has Read, Write, Create, Delete permissions.
#
# To create a SAS URI:
# 1. Go to Azure Portal > Storage Accounts > your account
# 2. Go to "Shared access signature"
# 3. Enable: Blob service, Container+Object resource types, Read+Write+Create+Delete permissions
# 4. Set an appropriate expiry date
# 5. Copy the generated SAS URL
# Azure Storage Account SAS URI (full URI with SAS token)
# Example: https://youraccount.blob.core.windows.net?sv=2021-06-08&ss=b&srt=sco&sp=rwdlac&se=...&sig=...
AZURE_STORAGE_SAS_URI=""
# Azure Storage container name for exports (will be created automatically)
AZURE_STORAGE_CONTAINER="bc-exports"
# ===================================
# Encryption Configuration