Repository navigation
Admin API for PTE publishing/installing for BC29 and later - #2425
spetersenms wants to merge 16 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The documentation omits that Scope Dev deployments installing or upgrading PTE dependencies on BC 30+ still require additional Admin Center API authorization and can fail without it.
1 open issue
What changed in this PR
This PR moves AL-Go’s PTE publishing and installation to the Admin Center API for Business Central 30 and later, while preserving legacy publishing for earlier versions.
Changes:
- Adds a shared, version-aware publisher with multipart uploads, operation polling, and bounded retries for transient status failures.
- Routes primary apps and PTE dependencies through the shared publisher and skips explicit old-version cleanup on BC 30+.
- Adds deployment tests and documents authorization requirements and service-managed cleanup.
| File | Description |
|---|---|
| Workshop/ContinuousDeployment.md | Documents authorization and cleanup behavior. |
| Tests/UnpublishOldAppVersions.Test.ps1 | Tests cleanup version boundaries and unknown versions. |
| Tests/PublishPTEApps.Test.ps1 | Tests routing, uploads, polling, and failure handling. |
| Tests/Deploy.Module.Test.ps1 | Tests shared publishing for PTE dependencies. |
| Tests/Deploy.Action.Test.ps1 | Tests action integration and cleanup sequencing. |
| Scenarios/settings.md | Updates deployment authorization and cleanup guidance. |
| Scenarios/RegisterSandboxEnvironment.md | Adds sandbox authorization instructions. |
| Scenarios/RegisterProductionEnvironment.md | Adds production authorization instructions. |
| RELEASENOTES.md | Announces authorization and cleanup changes. |
| Actions/Deploy/README.md | Describes publishing behavior and permissions. |
| Actions/Deploy/Deploy.psm1 | Implements shared publishing and version-aware cleanup. |
| Actions/Deploy/Deploy.ps1 | Uses the shared publisher for primary PTE apps. |
| Actions/.Modules/settings.schema.json | Aligns the cleanup setting description with version-specific behavior. |
Review effort: Balanced
There was a problem hiding this comment.
🟡 Changes recommended
The deployment router can silently query or publish apps against a same-named standard Business Central environment instead of the configured embed target, bypassing fallback and potentially deploying to the wrong environment.
1 open issue
1 resolved since last review
Review effort: Balanced
There was a problem hiding this comment.
🔵 Needs a closer look
Maintainer validation is needed for the live BC29/BC30 upload and operation-response contracts, including authorization, fallback behavior, and service-managed cleanup, because the available tests mock these service boundaries.
No open issues 🎉
1 resolved since last review
Review effort: Balanced
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 8500ace8-7ddb-4aab-9534-7b8d54d2d442



❔What, Why & How
Moves PTE deployment to the Admin Center API while retaining Automation API compatibility for older environments and deployments without Admin Center authorization. The Automation API's PTE upload endpoint is [deprecated and planned for removal in 2027 release wave 1](https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/administration/resources/dynamics_extensionupload).
Design boundaries
AdminCenterApi.psm1to own the Admin Center API contract, endpoint configuration and authentication context. AL-Go can support the new API without requiring a BCH release.Deploy.psm1: package ordering, installed-version checks, publishing and operation completion. The Admin path preserves BCH's existing behavior of skipping apps already installed at the same or a newer version.API selection
Before PTE publishing, AL-Go makes a read-only Admin request against the configured environment:
The selected path is fixed for the entire Deploy action, including PTE dependencies. Publishing or polling failures never trigger a switch. This avoids mixing deployment APIs and retrying an upload whose outcome may be uncertain. A successful authorization probe does not guarantee installation permission; subsequent failures are reported normally.
Configuration and authentication
deploymentBaseUrlanddeploymentApplicationFamilyconfigure the Admin target independently of BCH settings. They default to the standard Business Central API endpoint andBusinessCentral.AL-Go retains a dedicated Admin authentication context and reuses renewed tokens throughout the run, while leaving BCH's context unchanged. Existing authentication helpers are reused rather than introducing a separate OAuth implementation.
Cleanup
Admin deployments rely on service-managed cleanup. Automation deployments retain the existing optional
unpublishOldVersionsbehavior and its safeguards against removing installed or newer packages.✅ Checklist