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 PowerShell

HOW TO enable hyperv isolation in a Virtual Machine inside Hyper-V

Yes, virtualizzation of virtualizzation, this is possible.

The following guide helps to to enable the virtualizzation inside a VM.

Steps:

  • Turn off the VM
  • Open PowerShell as Administrator and run the following commands:
$vmName = 'DEV-VM' 
Set-VMProcessor -VMName $vmName -ExposeVirtualizationExtensions $true
Get-VMNetworkAdapter -VMName $vmName | Set-VMNetworkAdapter -MacAddressSpoofing On

This can be useful if you want create a BC container in hyperv isolation.

Did my HOW TO help you? Leave a reply.