DevOps HOW TO Microsoft PowerShell

Automated Releases on Environments with Application Family different of Business Central

The following PowerShell script is useful to automate the deployment of extensions, topically via DevOps Release Pipelines in the scenario of an Environment with Application Family different of Business Central, hosted in tenants not managed by Microsoft.
This script installs the BcContainerHelper, imports its module as it uses the function Publish-PerTenantExtensionApps. The apiBaseUrl environment variable is changed with the one of the ISV (in this example, lscentral of LS Retail).

Write-Host "Installing BcContainerHelper"
Install-Module BcContainerHelper -Force -AllowPrerelease
Import-Module BcContainerHelper -DisableNameChecking

$bcContainerHelperConfig.apiBaseUrl = ""

$bcauthContext = New-BcAuthContext -clientID $(PublisherAppClientID)" -clientSecret $(PublisherAppClientSecret)" -tenantID "$(TenantId)" -scopes ""

Write-Host "Publishing to tenant"
Publish-PerTenantExtensionApps -useNewLine -bcauthContext $bcauthContext -environment "$(Environment)" -companyName "$(CompanyName)"-appFiles @(Get-Item "Artifacts/output/Apps/*.app" | % { $_.FullName })

PublisherAppClientID, PublisherAppClientSecret, TenantId, Environment are variables declared in the Release Pipeline that will contain Client ID and Secret to authenticate via OAuth 2.0, the guid of the Tenant ID and the Environment name.

Did my post help you? Leave a reply.

Dynamics NAV Microsoft

NAV Development Environment does not show list of databases

Download and install Microsoft SQL Server Native Client both versions x32 and x64.