Skip to content

Commit f44ef03

Browse files
committed
[main@4476473] Update AL-Go System Files from microsoft/AL-Go-AppSource@main - 1113b4e
1 parent 4476473 commit f44ef03

26 files changed

Lines changed: 514 additions & 245 deletions

.AL-Go/cloudDevEnv.ps1

Lines changed: 104 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,103 @@
1-
#
2-
# Script for creating cloud development environment
3-
# Please do not modify this script as it will be auto-updated from the AL-Go Template
4-
# Recommended approach is to use as is or add a script (freddyk-devenv.ps1), which calls this script with the user specific parameters
5-
#
1+
<#
2+
.SYNOPSIS
3+
Creates a cloud-based development environment for Business Central AL development using SaaS Sandbox.
4+
5+
.DESCRIPTION
6+
This script sets up a cloud-based development environment by:
7+
- Creating a Business Central SaaS Sandbox environment
8+
- Compiling and publishing all apps and test apps to the development scope
9+
- Configuring launch.json for Visual Studio Code with Cloud Sandbox configuration
10+
- Optionally applying custom settings to override repository settings
11+
12+
The script will prompt you interactively for authentication using device code flow.
13+
For automated/unattended execution, you can configure AdminCenterApiCredentials as a GitHub secret
14+
or in Azure KeyVault. See https://aka.ms/algosettings for more information about AdminCenterApiCredentials.
15+
16+
This is an alternative to localDevEnv.ps1 for users who cannot run Docker containers locally.
17+
18+
RECOMMENDED USAGE:
19+
Instead of modifying this script directly (which will be overwritten during AL-Go updates),
20+
create a custom script that calls this one with your preferred parameters. For example,
21+
create a file named after yourself (e.g., 'john-devenv.ps1') that contains:
22+
23+
# My personal cloud development environment script
24+
$mySettings = '{"country":"us"}'
25+
. .\.AL-Go\cloudDevEnv.ps1 -environmentName "john-sandbox" -reuseExistingEnvironment $true -customSettings $mySettings
26+
27+
This approach allows you to:
28+
- Maintain your personal preferences without losing them during updates
29+
- Share your setup with team members
30+
- Version control your custom development configurations
31+
- Easily switch between different development scenarios
32+
33+
.PARAMETER environmentName
34+
The name of the cloud sandbox environment to create or reuse.
35+
If not specified, the script will prompt for input with a default of "{username}-sandbox".
36+
37+
.PARAMETER reuseExistingEnvironment
38+
Boolean parameter indicating whether to reuse an existing environment with the same name.
39+
If $true, the script will use the existing environment if it exists.
40+
If $false, the script will recreate the environment (deleting the old one if it exists).
41+
If not specified, the script will prompt the user to select the behavior.
42+
43+
.PARAMETER fromVSCode
44+
Switch parameter indicating the script is being run from Visual Studio Code.
45+
When specified, the script will pause at the end waiting for user input before closing.
46+
47+
.PARAMETER clean
48+
Switch parameter to create a clean development environment without compiling and publishing apps.
49+
Useful for setting up a fresh environment without deploying any applications.
50+
51+
.PARAMETER customSettings
52+
JSON string containing custom settings that override repository settings.
53+
These settings have the highest precedence and can be used to override country,
54+
or other configuration without modifying repository files.
55+
56+
.EXAMPLE
57+
.\cloudDevEnv.ps1
58+
Runs the script interactively, prompting for all required parameters.
59+
60+
.EXAMPLE
61+
.\cloudDevEnv.ps1 -environmentName "my-sandbox" -reuseExistingEnvironment $true
62+
Creates or reuses a cloud sandbox named "my-sandbox".
63+
64+
.EXAMPLE
65+
.\cloudDevEnv.ps1 -clean
66+
Creates a clean cloud development environment without compiling and publishing apps.
67+
68+
.EXAMPLE
69+
.\cloudDevEnv.ps1 -customSettings '{"country":"dk"}'
70+
Creates a cloud development environment with custom settings for Denmark country.
71+
72+
.EXAMPLE
73+
# Programmatic setup with custom settings
74+
$envName = "test-sandbox"
75+
$settings = '{"country": "us"}'
76+
77+
. ./cloudDevEnv.ps1 -environmentName $envName -reuseExistingEnvironment $true -customSettings $settings
78+
79+
Creates or reuses a cloud development environment with custom country setting.
80+
81+
.NOTES
82+
- Authentication is handled interactively via device code flow (https://aka.ms/devicelogin)
83+
- For unattended execution, configure AdminCenterApiCredentials secret (see link below)
84+
- Does not require Docker to be installed
85+
- Script automatically downloads required AL-Go helper modules and actions
86+
- Modifies launch.json in VS Code workspace for Cloud Sandbox configuration
87+
- Custom settings parameter allows runtime override of repository settings
88+
- If NewBcContainer.ps1 override exists, cloud development may not be supported
89+
90+
.LINK
91+
https://aka.ms/algosettings - AL-Go Settings Documentation
92+
https://github.com/microsoft/AL-Go/blob/main/Scenarios/CreateOnlineDevEnv2.md - Online Dev Environment Setup
93+
#>
94+
695
Param(
796
[string] $environmentName = "",
897
[bool] $reuseExistingEnvironment,
998
[switch] $fromVSCode,
10-
[switch] $clean
99+
[switch] $clean,
100+
[string] $customSettings = ""
11101
)
12102

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

52142
$tmpFolder = Join-Path ([System.IO.Path]::GetTempPath()) "$([Guid]::NewGuid().ToString())"
53143
New-Item -Path $tmpFolder -ItemType Directory -Force | Out-Null
54-
$GitHubHelperPath = DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go-Actions/v8.0/Github-Helper.psm1' -folder $tmpFolder -notifyAuthenticatedAttempt
55-
$ReadSettingsModule = DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go-Actions/v8.0/.Modules/ReadSettings.psm1' -folder $tmpFolder
56-
$debugLoggingModule = DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go-Actions/v8.0/.Modules/DebugLogHelper.psm1' -folder $tmpFolder
57-
$ALGoHelperPath = DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go-Actions/v8.0/AL-Go-Helper.ps1' -folder $tmpFolder
58-
DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go-Actions/v8.0/.Modules/settings.schema.json' -folder $tmpFolder | Out-Null
59-
DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go-Actions/v8.0/Environment.Packages.proj' -folder $tmpFolder | Out-Null
144+
$GitHubHelperPath = DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go-Actions/v8.1/Github-Helper.psm1' -folder $tmpFolder -notifyAuthenticatedAttempt
145+
$ReadSettingsModule = DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go-Actions/v8.1/.Modules/ReadSettings.psm1' -folder $tmpFolder
146+
$debugLoggingModule = DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go-Actions/v8.1/.Modules/DebugLogHelper.psm1' -folder $tmpFolder
147+
$ALGoHelperPath = DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go-Actions/v8.1/AL-Go-Helper.ps1' -folder $tmpFolder
148+
DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go-Actions/v8.1/.Modules/settings.schema.json' -folder $tmpFolder | Out-Null
149+
DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go-Actions/v8.1/Environment.Packages.proj' -folder $tmpFolder | Out-Null
60150

61151
Import-Module $GitHubHelperPath
62152
Import-Module $ReadSettingsModule
@@ -103,7 +193,8 @@ CreateDevEnv `
103193
-reuseExistingEnvironment:$reuseExistingEnvironment `
104194
-baseFolder $baseFolder `
105195
-project $project `
106-
-clean:$clean
196+
-clean:$clean `
197+
-customSettings $customSettings
107198
}
108199
catch {
109200
Write-Host -ForegroundColor Red "Error: $($_.Exception.Message)`nStacktrace: $($_.scriptStackTrace)"

.AL-Go/localDevEnv.ps1

Lines changed: 113 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,106 @@
1-
#
2-
# Script for creating local development environment
3-
# Please do not modify this script as it will be auto-updated from the AL-Go Template
4-
# Recommended approach is to use as is or add a script (freddyk-devenv.ps1), which calls this script with the user specific parameters
5-
#
1+
<#
2+
.SYNOPSIS
3+
Creates a local development environment for Business Central AL development using Docker containers.
4+
5+
.DESCRIPTION
6+
This script sets up a local development environment by:
7+
- Creating a Business Central container using Docker
8+
- Compiling and publishing all apps and test apps to the development scope
9+
- Configuring launch.json for Visual Studio Code with Local Sandbox configuration
10+
- Optionally applying custom settings to override repository settings
11+
12+
The script requires Docker to be installed and configured to run Windows containers.
13+
If Docker setup fails, users can alternatively run cloudDevEnv.ps1 for cloud-based development.
14+
15+
RECOMMENDED USAGE:
16+
Instead of modifying this script directly (which will be overwritten during AL-Go updates),
17+
create a custom script that calls this one with your preferred parameters. For example,
18+
create a file named after yourself (e.g., 'john-devenv.ps1') that contains:
19+
20+
# My personal development environment script
21+
$mySettings = '{"country":"us","artifact":"////nextminor"}'
22+
. .\.AL-Go\localDevEnv.ps1 -containerName "mydevenv" -auth UserPassword -customSettings $mySettings
23+
24+
This approach allows you to:
25+
- Maintain your personal preferences without losing them during updates
26+
- Share your setup with team members
27+
- Version control your custom development configurations
28+
- Easily switch between different development scenarios
29+
30+
.PARAMETER containerName
31+
The name of the Docker container to create. If not specified, the script will prompt for input.
32+
Default prompts for "bcserver" if not provided.
33+
34+
.PARAMETER auth
35+
Authentication mechanism for the container. Valid values are "UserPassword" or "Windows".
36+
If not specified, the script will prompt the user to select the authentication method.
37+
38+
.PARAMETER credential
39+
PSCredential object containing username and password for container authentication.
40+
If not provided, the script will prompt for credentials based on the selected auth method.
41+
42+
.PARAMETER licenseFileUrl
43+
Local path or secure download URL to a Business Central license file.
44+
For AppSource apps targeting BC versions prior to 22, a developer license with object ID permissions is required.
45+
For PTEs, this is optional but can be useful for dependent app object IDs.
46+
Set to "none" to skip license file input.
47+
48+
.PARAMETER fromVSCode
49+
Switch parameter indicating the script is being run from Visual Studio Code.
50+
When specified, the script will pause at the end waiting for user input before closing.
51+
52+
.PARAMETER accept_insiderEula
53+
Switch parameter to automatically accept the insider EULA when using Business Central insider builds.
54+
Required when working with insider artifacts.
55+
56+
.PARAMETER clean
57+
Switch parameter to create a clean development environment without compiling and publishing apps.
58+
Useful for setting up a fresh container without deploying any applications.
59+
60+
.PARAMETER customSettings
61+
JSON string containing custom settings that override repository settings.
62+
These settings have the highest precedence and can be used to override artifact URLs,
63+
country settings, or other configuration without modifying repository files.
64+
65+
.EXAMPLE
66+
.\localDevEnv.ps1
67+
Runs the script interactively, prompting for all required parameters.
68+
69+
.EXAMPLE
70+
.\localDevEnv.ps1 -containerName "mydevenv" -auth "UserPassword"
71+
Creates a container named "mydevenv" with username/password authentication, prompting for credentials and LicenseFile.
72+
73+
.EXAMPLE
74+
.\localDevEnv.ps1 -clean
75+
Creates a clean development environment without compiling and publishing apps.
76+
77+
.EXAMPLE
78+
.\localDevEnv.ps1 -customSettings '{"country":"dk","artifact":"////nextminor"}'
79+
Creates a development environment with custom settings for Denmark country and specific artifact.
80+
81+
.EXAMPLE
82+
# Programmatic setup with credentials and custom settings
83+
$Username = "SUPER"
84+
$Password = "<some password>"
85+
$cred = New-Object System.Management.Automation.PSCredential ($Username, (ConvertTo-SecureString $Password -AsPlainText -Force))
86+
$containerName = "bcserver"
87+
$settings = '{"artifact": "////nextminor"}'
88+
89+
. ./localDevEnv.ps1 -containerName $containerName -auth UserPassword -credential $cred -accept_insiderEula -licenseFileUrl "none" -customSettings $settings
90+
91+
Creates a development environment with predefined credentials, using next minor version artifact, accepting insider EULA, and no license file.
92+
93+
.NOTES
94+
- Requires Docker Desktop to be installed and running with Windows container support
95+
- For AppSource apps, may require a developer license for BC versions prior to 22
96+
- Script automatically downloads required AL-Go helper modules and actions
97+
- Modifies launch.json in VS Code workspace for Local Sandbox configuration
98+
- Custom settings parameter allows runtime override of repository settings
99+
100+
.LINK
101+
https://aka.ms/algosettings - AL-Go Settings Documentation
102+
#>
103+
6104
Param(
7105
[string] $containerName = "",
8106
[ValidateSet("UserPassword", "Windows")]
@@ -11,7 +109,8 @@ Param(
11109
[string] $licenseFileUrl = "",
12110
[switch] $fromVSCode,
13111
[switch] $accept_insiderEula,
14-
[switch] $clean
112+
[switch] $clean,
113+
[string] $customSettings = ""
15114
)
16115

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

56155
$tmpFolder = Join-Path ([System.IO.Path]::GetTempPath()) "$([Guid]::NewGuid().ToString())"
57156
New-Item -Path $tmpFolder -ItemType Directory -Force | Out-Null
58-
$GitHubHelperPath = DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go-Actions/v8.0/Github-Helper.psm1' -folder $tmpFolder -notifyAuthenticatedAttempt
59-
$ReadSettingsModule = DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go-Actions/v8.0/.Modules/ReadSettings.psm1' -folder $tmpFolder
60-
$debugLoggingModule = DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go-Actions/v8.0/.Modules/DebugLogHelper.psm1' -folder $tmpFolder
61-
$ALGoHelperPath = DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go-Actions/v8.0/AL-Go-Helper.ps1' -folder $tmpFolder
62-
DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go-Actions/v8.0/.Modules/settings.schema.json' -folder $tmpFolder | Out-Null
63-
DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go-Actions/v8.0/Environment.Packages.proj' -folder $tmpFolder | Out-Null
157+
$GitHubHelperPath = DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go-Actions/v8.1/Github-Helper.psm1' -folder $tmpFolder -notifyAuthenticatedAttempt
158+
$ReadSettingsModule = DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go-Actions/v8.1/.Modules/ReadSettings.psm1' -folder $tmpFolder
159+
$debugLoggingModule = DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go-Actions/v8.1/.Modules/DebugLogHelper.psm1' -folder $tmpFolder
160+
$ALGoHelperPath = DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go-Actions/v8.1/AL-Go-Helper.ps1' -folder $tmpFolder
161+
DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go-Actions/v8.1/.Modules/settings.schema.json' -folder $tmpFolder | Out-Null
162+
DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go-Actions/v8.1/Environment.Packages.proj' -folder $tmpFolder | Out-Null
64163

65164
Import-Module $GitHubHelperPath
66165
Import-Module $ReadSettingsModule
@@ -160,7 +259,8 @@ CreateDevEnv `
160259
-credential $credential `
161260
-licenseFileUrl $licenseFileUrl `
162261
-accept_insiderEula:$accept_insiderEula `
163-
-clean:$clean
262+
-clean:$clean `
263+
-customSettings $customSettings
164264
}
165265
catch {
166266
Write-Host -ForegroundColor Red "Error: $($_.Exception.Message)`nStacktrace: $($_.scriptStackTrace)"

.AL-Go/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$schema": "https://raw.githubusercontent.com/microsoft/AL-Go-Actions/v8.0/.Modules/settings.schema.json",
2+
"$schema": "https://raw.githubusercontent.com/microsoft/AL-Go-Actions/v8.1/.Modules/settings.schema.json",
33
"country": "lt",
44
"doNotPublishApps": true,
55
"useCompilerFolder": true,

.github/AL-Go-Settings.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"$schema": "https://raw.githubusercontent.com/microsoft/AL-Go-Actions/v8.0/.Modules/settings.schema.json",
2+
"$schema": "https://raw.githubusercontent.com/microsoft/AL-Go-Actions/v8.1/.Modules/settings.schema.json",
33
"type": "AppSource App",
44
"templateUrl": "https://github.com/microsoft/AL-Go-AppSource@main",
5-
"templateSha": "0fa7e9756b6e3ad9389c206b124646ae2e2eab08",
5+
"templateSha": "1113b4ecfdf93afc43119a1d6ed9a0dea21a8cb9",
66
"PartnerTelemetryConnectionString": "InstrumentationKey=5400e864-5abd-496c-837c-5fbea9914cb9;IngestionEndpoint=https://polandcentral-0.in.applicationinsights.azure.com/;LiveEndpoint=https://polandcentral.livediagnostics.monitor.azure.com/;ApplicationId=ccc6d211-3dd5-4ad1-8bec-db44e3dd9499",
77
"doNotRunBcptTests": true,
88
"doNotRunTests": true,

0 commit comments

Comments
 (0)