Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 104 additions & 13 deletions .AL-Go/cloudDevEnv.ps1
Original file line number Diff line number Diff line change
@@ -1,13 +1,103 @@
#
# Script for creating cloud development environment
# Please do not modify this script as it will be auto-updated from the AL-Go Template
# Recommended approach is to use as is or add a script (freddyk-devenv.ps1), which calls this script with the user specific parameters
#
<#
.SYNOPSIS
Creates a cloud-based development environment for Business Central AL development using SaaS Sandbox.

.DESCRIPTION
This script sets up a cloud-based development environment by:
- Creating a Business Central SaaS Sandbox environment
- Compiling and publishing all apps and test apps to the development scope
- Configuring launch.json for Visual Studio Code with Cloud Sandbox configuration
- Optionally applying custom settings to override repository settings

The script will prompt you interactively for authentication using device code flow.
For automated/unattended execution, you can configure AdminCenterApiCredentials as a GitHub secret
or in Azure KeyVault. See https://aka.ms/algosettings for more information about AdminCenterApiCredentials.

This is an alternative to localDevEnv.ps1 for users who cannot run Docker containers locally.

RECOMMENDED USAGE:
Instead of modifying this script directly (which will be overwritten during AL-Go updates),
create a custom script that calls this one with your preferred parameters. For example,
create a file named after yourself (e.g., 'john-devenv.ps1') that contains:

# My personal cloud development environment script
$mySettings = '{"country":"us"}'
. .\.AL-Go\cloudDevEnv.ps1 -environmentName "john-sandbox" -reuseExistingEnvironment $true -customSettings $mySettings

This approach allows you to:
- Maintain your personal preferences without losing them during updates
- Share your setup with team members
- Version control your custom development configurations
- Easily switch between different development scenarios

.PARAMETER environmentName
The name of the cloud sandbox environment to create or reuse.
If not specified, the script will prompt for input with a default of "{username}-sandbox".

.PARAMETER reuseExistingEnvironment
Boolean parameter indicating whether to reuse an existing environment with the same name.
If $true, the script will use the existing environment if it exists.
If $false, the script will recreate the environment (deleting the old one if it exists).
If not specified, the script will prompt the user to select the behavior.

.PARAMETER fromVSCode
Switch parameter indicating the script is being run from Visual Studio Code.
When specified, the script will pause at the end waiting for user input before closing.

.PARAMETER clean
Switch parameter to create a clean development environment without compiling and publishing apps.
Useful for setting up a fresh environment without deploying any applications.

.PARAMETER customSettings
JSON string containing custom settings that override repository settings.
These settings have the highest precedence and can be used to override country,
or other configuration without modifying repository files.

.EXAMPLE
.\cloudDevEnv.ps1
Runs the script interactively, prompting for all required parameters.

.EXAMPLE
.\cloudDevEnv.ps1 -environmentName "my-sandbox" -reuseExistingEnvironment $true
Creates or reuses a cloud sandbox named "my-sandbox".

.EXAMPLE
.\cloudDevEnv.ps1 -clean
Creates a clean cloud development environment without compiling and publishing apps.

.EXAMPLE
.\cloudDevEnv.ps1 -customSettings '{"country":"dk"}'
Creates a cloud development environment with custom settings for Denmark country.

.EXAMPLE
# Programmatic setup with custom settings
$envName = "test-sandbox"
$settings = '{"country": "us"}'

. ./cloudDevEnv.ps1 -environmentName $envName -reuseExistingEnvironment $true -customSettings $settings

Creates or reuses a cloud development environment with custom country setting.

.NOTES
- Authentication is handled interactively via device code flow (https://aka.ms/devicelogin)
- For unattended execution, configure AdminCenterApiCredentials secret (see link below)
- Does not require Docker to be installed
- Script automatically downloads required AL-Go helper modules and actions
- Modifies launch.json in VS Code workspace for Cloud Sandbox configuration
- Custom settings parameter allows runtime override of repository settings
- If NewBcContainer.ps1 override exists, cloud development may not be supported

.LINK
https://aka.ms/algosettings - AL-Go Settings Documentation
https://github.com/microsoft/AL-Go/blob/main/Scenarios/CreateOnlineDevEnv2.md - Online Dev Environment Setup
#>

Param(
[string] $environmentName = "",
[bool] $reuseExistingEnvironment,
[switch] $fromVSCode,
[switch] $clean
[switch] $clean,
[string] $customSettings = ""
)

$errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
Expand Down Expand Up @@ -51,12 +141,12 @@ Write-Host -ForegroundColor Yellow @'

$tmpFolder = Join-Path ([System.IO.Path]::GetTempPath()) "$([Guid]::NewGuid().ToString())"
New-Item -Path $tmpFolder -ItemType Directory -Force | Out-Null
$GitHubHelperPath = DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go/55f06533726d052e7603277236f2bcbcd67fa6cf/Actions/Github-Helper.psm1' -folder $tmpFolder -notifyAuthenticatedAttempt
$ReadSettingsModule = DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go/55f06533726d052e7603277236f2bcbcd67fa6cf/Actions/.Modules/ReadSettings.psm1' -folder $tmpFolder
$debugLoggingModule = DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go/55f06533726d052e7603277236f2bcbcd67fa6cf/Actions/.Modules/DebugLogHelper.psm1' -folder $tmpFolder
$ALGoHelperPath = DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go/55f06533726d052e7603277236f2bcbcd67fa6cf/Actions/AL-Go-Helper.ps1' -folder $tmpFolder
DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go/55f06533726d052e7603277236f2bcbcd67fa6cf/Actions/.Modules/settings.schema.json' -folder $tmpFolder | Out-Null
DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go/55f06533726d052e7603277236f2bcbcd67fa6cf/Actions/Environment.Packages.proj' -folder $tmpFolder | Out-Null
$GitHubHelperPath = DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go/ecbbde1e146bc26fa6e7aef790bcafe87e72ab2d/Actions/Github-Helper.psm1' -folder $tmpFolder -notifyAuthenticatedAttempt
$ReadSettingsModule = DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go/ecbbde1e146bc26fa6e7aef790bcafe87e72ab2d/Actions/.Modules/ReadSettings.psm1' -folder $tmpFolder
$debugLoggingModule = DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go/ecbbde1e146bc26fa6e7aef790bcafe87e72ab2d/Actions/.Modules/DebugLogHelper.psm1' -folder $tmpFolder
$ALGoHelperPath = DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go/ecbbde1e146bc26fa6e7aef790bcafe87e72ab2d/Actions/AL-Go-Helper.ps1' -folder $tmpFolder
DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go/ecbbde1e146bc26fa6e7aef790bcafe87e72ab2d/Actions/.Modules/settings.schema.json' -folder $tmpFolder | Out-Null
DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go/ecbbde1e146bc26fa6e7aef790bcafe87e72ab2d/Actions/Environment.Packages.proj' -folder $tmpFolder | Out-Null

Import-Module $GitHubHelperPath
Import-Module $ReadSettingsModule
Expand Down Expand Up @@ -103,7 +193,8 @@ CreateDevEnv `
-reuseExistingEnvironment:$reuseExistingEnvironment `
-baseFolder $baseFolder `
-project $project `
-clean:$clean
-clean:$clean `
-customSettings $customSettings
}
catch {
Write-Host -ForegroundColor Red "Error: $($_.Exception.Message)`nStacktrace: $($_.scriptStackTrace)"
Expand Down
126 changes: 113 additions & 13 deletions .AL-Go/localDevEnv.ps1
Original file line number Diff line number Diff line change
@@ -1,8 +1,106 @@
#
# Script for creating local development environment
# Please do not modify this script as it will be auto-updated from the AL-Go Template
# Recommended approach is to use as is or add a script (freddyk-devenv.ps1), which calls this script with the user specific parameters
#
<#
.SYNOPSIS
Creates a local development environment for Business Central AL development using Docker containers.

.DESCRIPTION
This script sets up a local development environment by:
- Creating a Business Central container using Docker
- Compiling and publishing all apps and test apps to the development scope
- Configuring launch.json for Visual Studio Code with Local Sandbox configuration
- Optionally applying custom settings to override repository settings

The script requires Docker to be installed and configured to run Windows containers.
If Docker setup fails, users can alternatively run cloudDevEnv.ps1 for cloud-based development.

RECOMMENDED USAGE:
Instead of modifying this script directly (which will be overwritten during AL-Go updates),
create a custom script that calls this one with your preferred parameters. For example,
create a file named after yourself (e.g., 'john-devenv.ps1') that contains:

# My personal development environment script
$mySettings = '{"country":"us","artifact":"////nextminor"}'
. .\.AL-Go\localDevEnv.ps1 -containerName "mydevenv" -auth UserPassword -customSettings $mySettings

This approach allows you to:
- Maintain your personal preferences without losing them during updates
- Share your setup with team members
- Version control your custom development configurations
- Easily switch between different development scenarios

.PARAMETER containerName
The name of the Docker container to create. If not specified, the script will prompt for input.
Default prompts for "bcserver" if not provided.

.PARAMETER auth
Authentication mechanism for the container. Valid values are "UserPassword" or "Windows".
If not specified, the script will prompt the user to select the authentication method.

.PARAMETER credential
PSCredential object containing username and password for container authentication.
If not provided, the script will prompt for credentials based on the selected auth method.

.PARAMETER licenseFileUrl
Local path or secure download URL to a Business Central license file.
For AppSource apps targeting BC versions prior to 22, a developer license with object ID permissions is required.
For PTEs, this is optional but can be useful for dependent app object IDs.
Set to "none" to skip license file input.

.PARAMETER fromVSCode
Switch parameter indicating the script is being run from Visual Studio Code.
When specified, the script will pause at the end waiting for user input before closing.

.PARAMETER accept_insiderEula
Switch parameter to automatically accept the insider EULA when using Business Central insider builds.
Required when working with insider artifacts.

.PARAMETER clean
Switch parameter to create a clean development environment without compiling and publishing apps.
Useful for setting up a fresh container without deploying any applications.

.PARAMETER customSettings
JSON string containing custom settings that override repository settings.
These settings have the highest precedence and can be used to override artifact URLs,
country settings, or other configuration without modifying repository files.

.EXAMPLE
.\localDevEnv.ps1
Runs the script interactively, prompting for all required parameters.

.EXAMPLE
.\localDevEnv.ps1 -containerName "mydevenv" -auth "UserPassword"
Creates a container named "mydevenv" with username/password authentication, prompting for credentials and LicenseFile.

.EXAMPLE
.\localDevEnv.ps1 -clean
Creates a clean development environment without compiling and publishing apps.

.EXAMPLE
.\localDevEnv.ps1 -customSettings '{"country":"dk","artifact":"////nextminor"}'
Creates a development environment with custom settings for Denmark country and specific artifact.

.EXAMPLE
# Programmatic setup with credentials and custom settings
$Username = "SUPER"
$Password = "<some password>"
$cred = New-Object System.Management.Automation.PSCredential ($Username, (ConvertTo-SecureString $Password -AsPlainText -Force))
$containerName = "bcserver"
$settings = '{"artifact": "////nextminor"}'

. ./localDevEnv.ps1 -containerName $containerName -auth UserPassword -credential $cred -accept_insiderEula -licenseFileUrl "none" -customSettings $settings

Creates a development environment with predefined credentials, using next minor version artifact, accepting insider EULA, and no license file.

.NOTES
- Requires Docker Desktop to be installed and running with Windows container support
- For AppSource apps, may require a developer license for BC versions prior to 22
- Script automatically downloads required AL-Go helper modules and actions
- Modifies launch.json in VS Code workspace for Local Sandbox configuration
- Custom settings parameter allows runtime override of repository settings

.LINK
https://aka.ms/algosettings - AL-Go Settings Documentation
#>

Param(
[string] $containerName = "",
[ValidateSet("UserPassword", "Windows")]
Expand All @@ -11,7 +109,8 @@ Param(
[string] $licenseFileUrl = "",
[switch] $fromVSCode,
[switch] $accept_insiderEula,
[switch] $clean
[switch] $clean,
[string] $customSettings = ""
)

$errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
Expand Down Expand Up @@ -55,12 +154,12 @@ Write-Host -ForegroundColor Yellow @'

$tmpFolder = Join-Path ([System.IO.Path]::GetTempPath()) "$([Guid]::NewGuid().ToString())"
New-Item -Path $tmpFolder -ItemType Directory -Force | Out-Null
$GitHubHelperPath = DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go/55f06533726d052e7603277236f2bcbcd67fa6cf/Actions/Github-Helper.psm1' -folder $tmpFolder -notifyAuthenticatedAttempt
$ReadSettingsModule = DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go/55f06533726d052e7603277236f2bcbcd67fa6cf/Actions/.Modules/ReadSettings.psm1' -folder $tmpFolder
$debugLoggingModule = DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go/55f06533726d052e7603277236f2bcbcd67fa6cf/Actions/.Modules/DebugLogHelper.psm1' -folder $tmpFolder
$ALGoHelperPath = DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go/55f06533726d052e7603277236f2bcbcd67fa6cf/Actions/AL-Go-Helper.ps1' -folder $tmpFolder
DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go/55f06533726d052e7603277236f2bcbcd67fa6cf/Actions/.Modules/settings.schema.json' -folder $tmpFolder | Out-Null
DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go/55f06533726d052e7603277236f2bcbcd67fa6cf/Actions/Environment.Packages.proj' -folder $tmpFolder | Out-Null
$GitHubHelperPath = DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go/ecbbde1e146bc26fa6e7aef790bcafe87e72ab2d/Actions/Github-Helper.psm1' -folder $tmpFolder -notifyAuthenticatedAttempt
$ReadSettingsModule = DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go/ecbbde1e146bc26fa6e7aef790bcafe87e72ab2d/Actions/.Modules/ReadSettings.psm1' -folder $tmpFolder
$debugLoggingModule = DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go/ecbbde1e146bc26fa6e7aef790bcafe87e72ab2d/Actions/.Modules/DebugLogHelper.psm1' -folder $tmpFolder
$ALGoHelperPath = DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go/ecbbde1e146bc26fa6e7aef790bcafe87e72ab2d/Actions/AL-Go-Helper.ps1' -folder $tmpFolder
DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go/ecbbde1e146bc26fa6e7aef790bcafe87e72ab2d/Actions/.Modules/settings.schema.json' -folder $tmpFolder | Out-Null
DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go/ecbbde1e146bc26fa6e7aef790bcafe87e72ab2d/Actions/Environment.Packages.proj' -folder $tmpFolder | Out-Null

Import-Module $GitHubHelperPath
Import-Module $ReadSettingsModule
Expand Down Expand Up @@ -160,7 +259,8 @@ CreateDevEnv `
-credential $credential `
-licenseFileUrl $licenseFileUrl `
-accept_insiderEula:$accept_insiderEula `
-clean:$clean
-clean:$clean `
-customSettings $customSettings
}
catch {
Write-Host -ForegroundColor Red "Error: $($_.Exception.Message)`nStacktrace: $($_.scriptStackTrace)"
Expand Down
2 changes: 1 addition & 1 deletion .AL-Go/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://raw.githubusercontent.com/microsoft/AL-Go/55f06533726d052e7603277236f2bcbcd67fa6cf/Actions/.Modules/settings.schema.json",
"$schema": "https://raw.githubusercontent.com/microsoft/AL-Go/ecbbde1e146bc26fa6e7aef790bcafe87e72ab2d/Actions/.Modules/settings.schema.json",
"country": "us",
"VersioningStrategy": 16,
"appFolders": [
Expand Down
4 changes: 2 additions & 2 deletions .github/AL-Go-Settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://raw.githubusercontent.com/microsoft/AL-Go/55f06533726d052e7603277236f2bcbcd67fa6cf/Actions/.Modules/settings.schema.json",
"$schema": "https://raw.githubusercontent.com/microsoft/AL-Go/ecbbde1e146bc26fa6e7aef790bcafe87e72ab2d/Actions/.Modules/settings.schema.json",
"type": "PTE",
"templateUrl": "https://github.com/microsoft/AL-Go-PTE@preview",
"conditionalSettings": [
Expand All @@ -25,5 +25,5 @@
},
"doNotSignApps": true,
"keyVaultCodesignCertificateName": "FreddyKristiansen",
"templateSha": "cb1099b0e43feda0a5b7a10e106fdf936002898e"
"templateSha": "8cdcecce69d888c287260b71c0922c2970126b1e"
}
18 changes: 17 additions & 1 deletion .github/RELEASENOTES.copy.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

Note that when using the preview version of AL-Go for GitHub, we recommend you Update your AL-Go system files, as soon as possible when informed that an update is available.

### Issues

- Issue 1961 KeyVault access in PR pipeline
- Discussion 1911 Add support for reportSuppressedDiagnostics
- Discussion 1968 Parameter for settings passed to CreateDevEnv
- Issue 1945 Deploy Reference Documentation fails for CI/CD

## v8.0

### Mechanism to overwrite complex settings type

By default, AL-Go merges settings from various places (see [settings levels](https://aka.ms/algosettings#where-are-the-settings-located)). Basic setting types such as `string` and `integer` are overwritten, but settings with complex types such as `array` and `object` are merged.
Expand All @@ -20,6 +29,13 @@ Please note that some automated features are premium and require the use of [Git

- Discussion 1885 Conditional settings for CI/CD are not applied
- Discussion 1899 Remove optional properties from "required" list in settings.schema.json
- Issue 1905 AL-Go system files update fails (Get Workflow Multi-Run Branches action fails when there are tags with same value but different casing)
- Issue 1926 Deployment fails when using build modes
- Issue 1898 GetDependencies in localDevEnv does not fallback to github token
- Issue 1947 Project settings are ignored when loading bccontainerhelper
- Issue 1937 trackALAlertsInGitHub is failing in preview
- DeployTo settings from environment-specific AL-Go settings are not applied when deploying
- `ReadSettings` action outputs too much information that is mainly used for debugging

## v7.3

Expand Down Expand Up @@ -912,7 +928,7 @@ Setting the repo setting "runs-on" to "Ubuntu-latest", followed by running Updat
### Issues

- Issue #143 Commit Message for **Increment Version Number** workflow
- Issue #160 Create local DevEnv aith appDependencyProbingPaths
- Issue #160 Create local DevEnv with appDependencyProbingPaths
- Issue #156 Versioningstrategy 2 doesn't use 24h format
- Issue #155 Initial Add existing app fails with "Cannot find path"
- Issue #152 Error when loading dependencies from releases
Expand Down
2 changes: 1 addition & 1 deletion .github/Test Current.settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://raw.githubusercontent.com/microsoft/AL-Go/55f06533726d052e7603277236f2bcbcd67fa6cf/Actions/settings.schema.json",
"$schema": "https://raw.githubusercontent.com/microsoft/AL-Go/ecbbde1e146bc26fa6e7aef790bcafe87e72ab2d/Actions/.Modules/settings.schema.json",
"artifact": "////latest",
"cacheImageName": "",
"versioningStrategy": 15,
Expand Down
Loading
Loading