Sometime there is the situation when you want to publish multiple apps in Business central which leads the dependences on each other.
In that case what we do, we go to Business central > Extension management > Upload extension and install our App one by one. it takes and consume much time. I will show you how you can put all your apps in one folder and execute the PowerShell command to install all those apps together by using the oAuth2.0 token.
First of all we need followings
- We should have our BC App registered in Azure Portal. Follow this link how to use Azure portal for register BC app for OAuth2.0
- We should have our Client id in Azure Active Directory which is generated in first and applied the consent as per below image
3. After providing consent in Azure Active Directory Open the PowerShell and run the below command
Install-Module BcContainerHelper -force >> More Info Here
After Installing BCContainerHelper command.
4. Now follow the below steps using your BC app registered in Azure portal.
$PublisherAppClientId = '413ac35bf8' $ClientSecret= '9w38Q~PJoLaAsL.Obu' $tenantId = '9cd39e6b-90e9-' $scopes = 'https://api.businesscentral.dynamics.com/.default' $bcauthContext = New-BcAuthContext ` -clientID $PublisherAppClientId ` -clientSecret (ConvertTo-SecureString -string $ClientSecret-AsPlainText -Force) ` -scopes $scopes ` -tenantId $tenantId // Your BC AL app folder where you can put all your .app files together $apps = "E:\APPInstall\" $environment = 'DEV_Sandbox' // AL publish command to install the folder's app in business central. Publish-PerTenantExtensionApps -bcAuthContext $bcAuthContext -environment $environment -appFiles $apps
Output
Note: Make sure you put all your apps in the folder as per sorting, which one should be install first and then so on.
Reach me out if there is any problem.
All the best.