---
id: change/al-go/2340
type: change
title: "#2340 Add opt-in unpublishOldVersions setting to unpublish stale PTE app versions after deploy"
summary: AL-Go now supports an opt-in setting to automatically unpublish old, uninstalled versions of Per Tenant Extensions after deployment, keeping the Extension Management list clean and reducing clutter.
tier: official
language: en
tags:
  - feature
  - main
system: platform
review:
  state: reviewed
  by: opus
  at: "2026-10-08T02:04:39.890Z"
  flags: []
generated:
  at: "2026-10-08T01:26:53.141Z"
  pipeline: 0.2.0
  prompts:
    extract-change: 1
  input_hash: a41a641716f909d611fb3df3a69e7b0f71170e7e
evidence:
  - kind: code
    url: https://github.com/microsoft/AL-Go/pull/2340
    title: "microsoft/AL-Go#2340: Add opt-in unpublishOldVersions setting to unpublish stale PTE app versions after deploy"
    date: "2026-09-17"
    commit: a41a641716f909d611fb3df3a69e7b0f71170e7e
    t: null
    quote: Automatically clean up those stale versions right after a successful deployment.
links:
  learn: []
  objects: []
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes: []
number: 2340
repo: microsoft/AL-Go
source_id: al-go-prs
url: https://github.com/microsoft/AL-Go/pull/2340
kind: pr
base_branch: main
major: null
merged_at: "2026-09-17T14:29:00Z"
author: louagej
author_type: User
community_contribution: false
labels: []
change_class: code
change_kind: feature
behavior_change: false
breaking: false
files:
  count: 9
  additions: 397
  deletions: 6
  al: 4
apps: []
objects_touched: []
objects_unjoined:
  - path: Actions/.Modules/settings.schema.json
    status: modified
    reason: not-in-snapshot
  - path: Actions/Deploy/Deploy.ps1
    status: modified
    reason: not-in-snapshot
  - path: Actions/Deploy/Deploy.psm1
    status: modified
    reason: not-in-snapshot
  - path: Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1
    status: modified
    reason: not-in-snapshot
obsoletions: []
backports: []
fixes_issues: []
work_items: []
systems:
  - platform
quote: Automatically clean up those stale versions right after a successful deployment.
joined_against:
  major: null
  commit: null
---

# #2340 Add opt-in unpublishOldVersions setting to unpublish stale PTE app versions after deploy

> AL-Go now supports an opt-in setting to automatically unpublish old, uninstalled versions of Per Tenant Extensions after deployment, keeping the Extension Management list clean and reducing clutter.

[Pull request](https://github.com/microsoft/AL-Go/pull/2340) · merged into `main` on 2026-09-17 by louagej · 9 files (+397 -6), 4 AL · feature · tier official · reviewed (checked by Opus)

## What changed

- New optional unpublishOldVersions boolean property on DeployTo environment settings, disabled by default
- After deployment, the system identifies and unpublishes only versions that are uninstalled and older than an installed version of the same app
- Uses Automation API v2.0 endpoint Microsoft.NAV.unpublish to perform the cleanup
- Operation is non-fatal and wrapped in error handling to never block deployments
- Only applies to Per Tenant Extension deployment path; existing users see zero behavior change

## AL objects touched

- `Actions/.Modules/settings.schema.json`: modified, not in the BC? snapshot
- `Actions/Deploy/Deploy.ps1`: modified, not in the BC? snapshot
- `Actions/Deploy/Deploy.psm1`: modified, not in the BC? snapshot
- `Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1`: modified, not in the BC? snapshot

## Context

- Systems: platform
- From the description: "Automatically clean up those stale versions right after a successful deployment."

Source: metadata of a merged pull request in microsoft/AL-Go (al-go): title, labels, changed paths and counts, with a summary in our words. No source text and no description beyond one short quote (D10, D61).
