Categories
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 = "https://lscentral.api.bc.dynamics.com"

$bcauthContext = New-BcAuthContext -clientID $(PublisherAppClientID)" -clientSecret $(PublisherAppClientSecret)" -tenantID "$(TenantId)" -scopes "https://api.businesscentral.dynamics.com/.default"

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.

Categories
HOW TO Microsoft Windows 11

Last Windows Update generates issues

Windows often shows updates that are in Preview that can be installed and sometimes could have unknown issues/bugs.

If you installed a Windows update and then your system is not working properly the easiest solution is to unistall it.
This happened yesterday with the Preview update KB5028245 in Windows 11 that made my screen blinking.
How to proceed in these cases?

Solution:

How to uninstall Windows Updates via Command Prompt

Steps:

  1. Use Ctrl+Alt+Delete if you are working in your pc
    or Ctrl+Alt+End if you are connected in RDP
  2. Click on Task Manager
  3. Navigate to the menu File -> Run new task
  4. Write cmd and tick the checkbox Create this task with administrative provileges.
  5. Run the command wmic qfe list to retrieve the list of latest updates installed and indetify the one to be uninstalled
  6. Run the command wusa.exe /uninstall /kb:<KB ID> like for example:
    wusa.exe /uninstall /kb:5028245

Did my solution solve your problem? Leave a reply.