Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
6896768
Initial Deploy via Admin API 2.29 implementation.
spetersenms Oct 28, 2026
114cdcd
Setting new API cutoff to BC30 and extending documentation
spetersenms Oct 29, 2026
8e5ce34
Merge main
spetersenms Oct 29, 2026
df59a57
Fixing failing tests.
spetersenms Nov 2, 2026
d157cfc
Fixing documentation
spetersenms Nov 2, 2026
e87d3f7
Cleanup and moving Admin Api logic to separate module.
spetersenms Nov 9, 2026
e48df19
Merge main
spetersenms Nov 10, 2026
46aa4bb
Various cleanup of logic.
spetersenms Nov 12, 2026
8b5b6e9
Merge branch 'main' into spetersen-microsoft-pte-al-go-integration
spetersenms Nov 12, 2026
79e9e6e
Smaller fixes
spetersenms Nov 13, 2026
a6ccbdc
Merge remote feature updates while preserving local fixes
spetersenms Nov 13, 2026
9d1c751
Simplify error handling
spetersenms Nov 13, 2026
9c18a1a
Moving functionality to admin helper
spetersenms Nov 16, 2026
b730909
Fixing ps5 bug
spetersenms Nov 16, 2026
205ed89
More logging
spetersenms Nov 17, 2026
e741bf5
Merge branch 'main' into spetersen-microsoft-pte-al-go-integration
spetersenms Nov 17, 2026
18dfa2c
Merge branch 'main' into spetersen-microsoft-pte-al-go-integration
spetersenms Nov 20, 2026
e02a3d0
Merge main and keep PTE migration notes above v10.1
spetersenms Nov 25, 2026
113b7d5
Merge main and fix AI comments
spetersenms Nov 26, 2026
2bb5ceb
Changes new setting to complex object and removes unneeded inline scr…
spetersenms Nov 26, 2026
8400b4e
Refine Admin API timeout handling and deployment documentation
spetersenms Nov 30, 2026
e4ff40f
Merge branch 'main' into spetersen-microsoft-pte-al-go-integration
spetersenms Nov 30, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
519 changes: 519 additions & 0 deletions Actions/.Modules/AdminCenterApi.psm1

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions Actions/.Modules/ReadSettings.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,11 @@ function GetDefaultSettings
}
"pullRequestTrigger" = "pull_request"
"skipDraftPullRequests" = $false
"adminCenterApi" = [ordered]@{
"baseUrl" = "https://api.businesscentral.dynamics.com"
"applicationFamily" = "BusinessCentral"
"operationTimeoutMinutes" = 30
}
"bcptThresholds" = [ordered]@{
"DurationWarning" = 10
"DurationError" = 25
Expand Down
31 changes: 30 additions & 1 deletion Actions/.Modules/settings.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,35 @@
"description": "Schema for AL-Go settings",
"type": "object",
"properties": {
"adminCenterApi": {
"type": "object",
"default": {
"baseUrl": "https://api.businesscentral.dynamics.com",
"applicationFamily": "BusinessCentral",
"operationTimeoutMinutes": 30
},
"description": "Optional repository target for native Admin Center reads, PTE publishing and polling in the standard Deploy action in both templates (CI/CD and Publish To Environment). Independent of BcContainerHelper configuration. Does not change Automation, AppSource or web-client configuration. See https://aka.ms/ALGoSettings#adminCenterApi",
"properties": {
"baseUrl": {
"type": "string",
"default": "https://api.businesscentral.dynamics.com",
"pattern": "^(|https://[^\\s?#]+)$",
"description": "HTTPS API root without credentials, query or fragment. Defaults to https://api.businesscentral.dynamics.com; an explicit empty string also uses this endpoint. Sets the default resource for an isolated Admin authentication context; explicit AUTHCONTEXT scopes or resource are preserved."
},
"applicationFamily": {
"type": "string",
"minLength": 1,
"pattern": "\\S",
"default": "BusinessCentral",
"description": "Application family used by Admin Center installed-app reads, PTE publishing and operation polling. Never inferred from baseUrl. Automation URLs do not contain a family segment."
},
"operationTimeoutMinutes": {
"type": "integer",
"default": 30,
"description": "Per-app elapsed polling timeout in minutes after a native PTE upload completes, in CI/CD and Publish To Environment in both templates. 0 disables this deadline; a negative integer emits a warning and is treated as 0. Workflow/job timeouts still apply. Does not change upload/request timeouts or consecutive transient status-read retries. Does not affect Automation publishing."
}
}
},
"type": {
"type": "string",
"minLength": 1,
Expand Down Expand Up @@ -990,7 +1019,7 @@
"unpublishOldVersions": {
"type": "boolean",
"default": false,
"description": "When set to true, AL-Go unpublishes old, uninstalled versions of the deployed apps from the environment after a successful deployment. Only applies to PTE deployments (Scope PTE) and is non-fatal. See https://aka.ms/ALGoSettings#deployto"
"description": "Optional boolean, default false. After successful Scope PTE deployment through Automation on Business Central 25.4 or later, unpublishes only selected primary apps' uninstalled versions older than the currently installed version, including apps skipped because the same or a newer version is installed. With the Admin Center route, explicit cleanup is skipped; Business Central manages background cleanup, whose timing and retained versions are not guaranteed. This setting does not control background cleanup. Skipped cleanup and cleanup failures are warnings; does not apply to Scope Dev or custom deployments. See https://aka.ms/ALGoSettings#deployto"
}
}
}
Expand Down
29 changes: 23 additions & 6 deletions Actions/Deploy/Deploy.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Param(
)

Import-Module (Join-Path -Path $PSScriptRoot "Deploy.psm1")
Import-Module (Join-Path $PSScriptRoot '..\.Modules\AdminCenterApi.psm1') -DisableNameChecking
. (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1" -Resolve)
DownloadAndImportBcContainerHelper

Expand Down Expand Up @@ -167,6 +168,23 @@ else {
Write-Host "::Warning::Ignoring environment $($deploymentSettings.EnvironmentName), which is a production environment, as deploying from a PR is only supported in sandbox environments"
}
else {
$hasPTEDependencies = $false
if ($scope -eq 'Dev' -and $deploymentSettings.DependencyInstallMode -ne 'ignore') {
foreach ($dependency in $dependencies) {
$appJson = Get-AppJsonFromAppFile -appFile $dependency
if ($appJson.idRanges.from -ge 50000 -and $appJson.idRanges.from -lt 100000) {
Comment thread
spetersenms marked this conversation as resolved.
Resolved
$hasPTEDependencies = $true
break
}
}
}
if ($scope -eq 'PTE' -or $hasPTEDependencies) {
# This copy will eventually be replaced by AL-Go native auth.
$adminAuthContext = $bcAuthContext.Clone()
Initialize-AdminCenterAuthContext -authContext $adminAuthContext -settings $settings `
-preserveScopes:([bool]($authContextParams['scopes'] -or $authContextParams['resource']))
Initialize-PTEPublishingApi -bcAuthContext $bcAuthContext -environment $deploymentSettings.EnvironmentName
}
if ($dependencies) {
InstallOrUpgradeApps -bcAuthContext $bcAuthContext -environment $deploymentSettings.EnvironmentName -Apps $dependencies -installMode $deploymentSettings.DependencyInstallMode
}
Expand All @@ -193,15 +211,14 @@ else {
Publish-BcContainerApp @parameters -useDevEndpoint -checkAlreadyInstalled -excludeRuntimePackages -replacePackageId
}
else {
# Use automation API for production environments (Publish-PerTenantExtensionApps)
$parameters = @{
"bcAuthContext" = $bcAuthContext
"environment" = $deploymentSettings.EnvironmentName
"appFiles" = $apps
}
if ($deploymentSettings.SyncMode) {
if (@('Add','ForceSync') -notcontains $deploymentSettings.SyncMode) {
throw "Invalid SyncMode $($deploymentSettings.SyncMode) when deploying using the automation API. Valid values are Add and ForceSync."
throw "Invalid SyncMode $($deploymentSettings.SyncMode) when deploying Per Tenant Extensions. Valid values are Add and ForceSync."
}
Write-Host "Using $($deploymentSettings.SyncMode)"
$syncMode = $deploymentSettings.SyncMode
Expand All @@ -211,18 +228,18 @@ else {

CheckInstalledApps -bcAuthContext $bcAuthContext -environment $deploymentSettings.EnvironmentName -appFiles $apps

Write-Host "Publishing apps using automation API"
Publish-PerTenantExtensionApps @parameters
Write-Host "Publishing Per Tenant Extensions"
PublishPTEApps @parameters
Comment thread
spetersenms marked this conversation as resolved.
Resolved

if (($deploymentSettings['unpublishOldVersions'] -is [bool]) -and $deploymentSettings['unpublishOldVersions']) {
Write-Host "Unpublishing old app versions"
Write-Host "Checking cleanup of old app versions"
UnpublishOldAppVersions -bcAuthContext $bcAuthContext -environment $deploymentSettings.EnvironmentName -appFiles $apps
}
}
}
}
catch {
OutputError -message "Deploying to $environmentName failed.$([environment]::Newline) $($_.Exception.Message)"
OutputError -message "Deploying to $environmentName failed.$([environment]::Newline) $_"
exit
}
}
Loading
Loading