Skip to content

Admin API for PTE publishing/installing for BC29 and later - #2425

Open
spetersenms wants to merge 16 commits into
microsoft:mainfrom
spetersenms:spetersen-microsoft-pte-al-go-integration
Open

spetersenms wants to merge 16 commits into
microsoft:mainfrom
spetersenms:spetersen-microsoft-pte-al-go-integration

Conversation

@spetersenms

@spetersenms spetersenms commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

❔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

  • Adds AdminCenterApi.psm1 to own the Admin Center API contract, endpoint configuration and authentication context. AL-Go can support the new API without requiring a BCH release.
  • Keeps deployment orchestration in 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.
  • Leaves BCH responsible for the existing Automation publishing path.

API selection

Before PTE publishing, AL-Go makes a read-only Admin request against the configured environment:

  • Successful access on BC29 or later selects Admin.
  • Explicit authentication or authorization failure selects Automation and emits a warning explaining the required setup.
  • Older BC versions use Automation.
  • Unexpected failures stop deployment rather than silently selecting another API.

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

deploymentBaseUrl and deploymentApplicationFamily configure the Admin target independently of BCH settings. They default to the standard Business Central API endpoint and BusinessCentral.

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 unpublishOldVersions behavior and its safeguards against removing installed or newer packages.

✅ Checklist

  • Add tests (E2E, unit tests)
  • Update RELEASENOTES.md
  • Update documentation (e.g. for new settings or scenarios)
  • Add telemetry

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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

Comment thread Workshop/ContinuousDeployment.md Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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

Comment thread Actions/Deploy/Deploy.psm1 Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 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

@spetersenms spetersenms changed the title Admin API for PTE publishing/installing for BC30 and later Admin API for PTE publishing/installing for BC29 and later Nov 12, 2026
@spetersenms
spetersenms marked this pull request as ready for review November 12, 2026 17:40
@spetersenms
spetersenms requested a review from a team as a code owner November 12, 2026 17:40
spetersenms and others added 4 commits November 13, 2026 17:30
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 8500ace8-7ddb-4aab-9534-7b8d54d2d442

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Deployment can incorrectly fall back to Automation after token-renewal network failures or abort when an unrelated extension shares the Application display name.

2 open issues

Review effort: Balanced

Comment thread Actions/.Modules/AdminCenterApi.psm1 Resolved
Comment thread Actions/.Modules/AdminCenterApi.psm1 Resolved

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants