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
DevOps

Visual Studio Enterprise subscription access level in DevOps using Alternate account

Summary:

  1. You have an MSDN license assigned to you
  2. You want to use yout MSDN license to access to DevOps with a different account

Let’s first verify that actually you have an MSDN license assigned to you, connect to the following link using an Incognito window from your browser: https://my.visualstudio.com/Subscriptions
In this page you can check if you have a subscription active, in my case I can see Visual Studio Enterprise (MPN).

At the bottom you can setup an Alternate account, an email different from the one assigned to the Subscription that can benefit to the same access, including Azure DevOps.

Issue:

Visual Studio Subscriber access level not working

If you have setup an Alternate account after the same email has been used to add a DevOps user you will face an issue because DevOps will be not able to check you have a Subscription and you will be assigned as Stakeholder with limited access.

Solution:

Remove and re-add the user from DevOps.

Did my solution solve your problem? Leave a reply.