Introduction
Nothing new and revolutionary that doesn't already exist, but here's another way to connect Azure DevOps Release Pipeline and BcContainerHelper.
Here is a more detailed description of setting up the Automatic AppSource Submission of Business Central apps, so I won't go into the details, but the emphasis will be on how this can be accomplished with a Release pipeline.
Prerequisites
- Created a build pipeline for the app that needs to go to AppSource.
Script for Automatic AppSource Submission of Business Central apps
Source code:
#install bccontainerhelper $module = Get-InstalledModule -Name bccontainerhelper -ErrorAction Ignore if ($module) { $versionStr = $module.Version.ToString() Write-Host "##[section]BcContainerHelper $VersionStr is installed" Write-Host "##[section]Determine latest BcContainerHelper version" $latestVersion = (Find-Module -Name bccontainerhelper).Version $latestVersionStr = $latestVersion.ToString() Write-Host "##[section]BcContainerHelper $latestVersionStr is the latest version" if ($latestVersion -gt $module.Version) { Write-Host "##[command]Updating BcContainerHelper to $latestVersionStr" Update-Module -Name bccontainerhelper -Force -RequiredVersion $latestVersionStr Write-Host "##[section]BcContainerHelper updated" } } else { Write-Host "##[command]Installing BcContainerHelper" Install-Module -Name bccontainerhelper -Force $module = Get-InstalledModule -Name bccontainerhelper -ErrorAction Ignore $versionStr = $module.Version.ToString() Write-Host "##[section]BcContainerHelper $VersionStr installed" } #install bccontainerhelper $ArtifactsDirectory = (Join-Path -Path $env:System_ArtifactsDirectory -ChildPath ($env:Release_PrimaryArtifactSourceAlias + '\Artifacts')) $appFile = Get-ChildItem -Path $ArtifactsDirectory -Filter "*.app" $authContext = New-BcAuthContext -refreshToken $env:refreshToken -Scopes "https://api.partner.microsoft.com/.default" -tenantID $env:TENANTID New-AppSourceSubmission -authContext $authContext -productId $env:productId -appFile $appFile.FullName -silent -doNotWait -autoPromote
Release pipeline
In your project create release pipeline
Script path:
$(System.DefaultWorkingDirectory)/$(Release.PrimaryArtifactSourceAlias)/Artifacts/AppSourceSubmission.ps1
This way, the procedure can be reused for all apps that need to go to AppSource.
Conclusion
A short post on how to combine existing mechanisms and make your life easier with AppSource apps.
If you have a repository of an app that needs to go on App Source in Azure DevOps, then this is a simple way to automate that process. Note that Al-Go has all of this built in for free, and there's no need to write your own scripts and if you are not tied to Azure DevOps and can easily migrate your repo to GitHub.
Add comment
Comments