Publishing apps to a Business Central Online by Powershell
#1 Kinds of Apps
There are 2 kinds of apps: AppSource Apps and Per Tenant Extensions (PTEs). These apps can be installed in two kinds of environments: Sandbox and Production.
In Production, AppSource Apps are installed in the global scope (Global) and Per Tenant Extensions are installed in the Tenant Scope (PTE). In Sandbox environments, you can also install apps to the development scope (Dev – like what VS Code does).
Example: Global, PTE, Dev
#2 Using “Publish-PerTenantExtensionApps” to Publishing PTEs to the Tenant Scope in a Production or Sandbox Environment
The easiest way to create a BcAuthContext is by issuing this command: $authContext = New-BcAuthContext –includeDeviceLogin – //TOKEN REQUEST
#INSTALL APPS USING –includeDeviceLogin GET TOKEN
$authContext = New-BcAuthContext –includeDeviceLogin #GET TOKEN
$environment = ‘Production’ #Production Env
$apps = ‘c:\temp\Apps\’
-environment $environment `
Put sample APPS in this folder
Execute the Powershell script
TOKEN REQUEST BY GIVEN TEMPO AUTH CODE
Token retrieved, authorization granted
Apps Publishing and Installing..
Apps have been installed
#3 – To check if App is installed on Business Central Online
To check if the apps have been installed and which version has actually been installed, you can use the same script by running it without indicating the APP to be installed. The system extracts the list of all installed apps and their version.