From 4d5014ac87a82fea2573d821239e0ffd8c02eebc Mon Sep 17 00:00:00 2001 From: freddydk Date: Sun, 30 Oct 2022 07:15:55 +0000 Subject: [PATCH] 'Updated AL-Go System Files' --- .github/AL-Go-Settings.json | 2 +- BO-DK/.AL-Go/cloudDevEnv.ps1 | 106 ++++++++++++++++++++++ BO-DK/.AL-Go/localDevEnv.ps1 | 167 +++++++++++++++++++++++++++++++++++ BO-IT/.AL-Go/cloudDevEnv.ps1 | 106 ++++++++++++++++++++++ BO-IT/.AL-Go/localDevEnv.ps1 | 167 +++++++++++++++++++++++++++++++++++ BO-W1/.AL-Go/cloudDevEnv.ps1 | 106 ++++++++++++++++++++++ BO-W1/.AL-Go/localDevEnv.ps1 | 167 +++++++++++++++++++++++++++++++++++ Misc/.AL-Go/cloudDevEnv.ps1 | 106 ++++++++++++++++++++++ Misc/.AL-Go/localDevEnv.ps1 | 167 +++++++++++++++++++++++++++++++++++ 9 files changed, 1093 insertions(+), 1 deletion(-) create mode 100644 BO-DK/.AL-Go/cloudDevEnv.ps1 create mode 100644 BO-DK/.AL-Go/localDevEnv.ps1 create mode 100644 BO-IT/.AL-Go/cloudDevEnv.ps1 create mode 100644 BO-IT/.AL-Go/localDevEnv.ps1 create mode 100644 BO-W1/.AL-Go/cloudDevEnv.ps1 create mode 100644 BO-W1/.AL-Go/localDevEnv.ps1 create mode 100644 Misc/.AL-Go/cloudDevEnv.ps1 create mode 100644 Misc/.AL-Go/localDevEnv.ps1 diff --git a/.github/AL-Go-Settings.json b/.github/AL-Go-Settings.json index b52ff3f..0565ef1 100644 --- a/.github/AL-Go-Settings.json +++ b/.github/AL-Go-Settings.json @@ -1,4 +1,4 @@ -{ +{ "type": "PTE", "templateUrl": "https://github.com/freddydk/AL-Go-PTE@main", "useProjectDependencies": true diff --git a/BO-DK/.AL-Go/cloudDevEnv.ps1 b/BO-DK/.AL-Go/cloudDevEnv.ps1 new file mode 100644 index 0000000..98f7a6e --- /dev/null +++ b/BO-DK/.AL-Go/cloudDevEnv.ps1 @@ -0,0 +1,106 @@ +# +# 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 +# +Param( + [string] $environmentName = "", + [bool] $reuseExistingEnvironment, + [switch] $fromVSCode +) + +$ErrorActionPreference = "stop" +Set-StrictMode -Version 2.0 + +$pshost = Get-Host +if ($pshost.Name -eq "Visual Studio Code Host") { + $executionPolicy = Get-ExecutionPolicy -Scope CurrentUser + Write-Host "Execution Policy is $executionPolicy" + if ($executionPolicy -eq "Restricted") { + Write-Host "Changing Execution Policy to RemoteSigned" + Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser -Force + } + if ($MyInvocation.InvocationName -eq '.' -or $MyInvocation.Line -eq '') { + $scriptName = Join-Path $PSScriptRoot $MyInvocation.MyCommand + } + else { + $scriptName = $MyInvocation.InvocationName + } + if (Test-Path -Path $scriptName -PathType Leaf) { + $scriptName = (Get-Item -path $scriptName).FullName + $pslink = Join-Path $env:APPDATA "Microsoft\Windows\Start Menu\Programs\Windows PowerShell\Windows PowerShell.lnk" + if (!(Test-Path $pslink)) { + $pslink = "powershell.exe" + } + Start-Process -Verb runas $pslink @("-Command ""$scriptName"" -fromVSCode -environmentName '$environmentName' -reuseExistingEnvironment `$$reuseExistingEnvironment") + return + } +} + +try { +$ALGoHelperPath = "$([System.IO.Path]::GetTempFileName()).ps1" +$webClient = New-Object System.Net.WebClient +$webClient.CachePolicy = New-Object System.Net.Cache.RequestCachePolicy -argumentList ([System.Net.Cache.RequestCacheLevel]::NoCacheNoStore) +$webClient.Encoding = [System.Text.Encoding]::UTF8 +Write-Host "Downloading AL-Go Helper script" +$webClient.DownloadFile('https://raw.githubusercontent.com/freddydk/AL-Go-Actions/main/AL-Go-Helper.ps1', $ALGoHelperPath) +. $ALGoHelperPath -local + +$baseFolder = Join-Path $PSScriptRoot ".." -Resolve + +Clear-Host +Write-Host -ForegroundColor Yellow @' + _____ _ _ _____ ______ + / ____| | | | | __ \ | ____| + | | | | ___ _ _ __| | | | | | _____ __ |__ _ ____ __ + | | | |/ _ \| | | |/ _` | | | | |/ _ \ \ / / __| | '_ \ \ / / + | |____| | (_) | |_| | (_| | | |__| | __/\ V /| |____| | | \ V / + \_____|_|\___/ \__,_|\__,_| |_____/ \___| \_/ |______|_| |_|\_/ + +'@ + +Write-Host @' +This script will create a cloud based development environment (Business Central SaaS Sandbox) for your project. +All apps and test apps will be compiled and published to the environment in the development scope. +The script will also modify launch.json to have a "Cloud Sandbox ()" configuration point to your environment. + +'@ + +if (Test-Path (Join-Path $PSScriptRoot "NewBcContainer.ps1")) { + Write-Host -ForegroundColor Red "WARNING: The project has a NewBcContainer override defined. Typically, this means that you cannot run a cloud development environment" +} + +$settings = ReadSettings -baseFolder $baseFolder -userName $env:USERNAME + +Write-Host + +if (-not $environmentName) { + $environmentName = Enter-Value ` + -title "Environment name" ` + -question "Please enter the name of the environment to create" ` + -default "$($env:USERNAME)-sandbox" +} + +if (-not $PSBoundParameters.ContainsKey('reuseExistingEnvironment')) { + $reuseExistingEnvironment = (Select-Value ` + -title "What if the environment already exists?" ` + -options @{ "Yes" = "Reuse existing environment"; "No" = "Recreate environment" } ` + -question "Select behavior" ` + -default "No") -eq "Yes" +} + +CreateDevEnv ` + -kind cloud ` + -caller local ` + -environmentName $environmentName ` + -reuseExistingEnvironment:$reuseExistingEnvironment ` + -baseFolder $baseFolder +} +catch { + Write-Host -ForegroundColor Red "Error: $($_.Exception.Message)`nStacktrace: $($_.scriptStackTrace)" +} +finally { + if ($fromVSCode) { + Read-Host "Press ENTER to close this window" + } +} diff --git a/BO-DK/.AL-Go/localDevEnv.ps1 b/BO-DK/.AL-Go/localDevEnv.ps1 new file mode 100644 index 0000000..1502393 --- /dev/null +++ b/BO-DK/.AL-Go/localDevEnv.ps1 @@ -0,0 +1,167 @@ +# +# 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 +# +Param( + [string] $containerName = "", + [string] $auth = "", + [pscredential] $credential = $null, + [string] $licenseFileUrl = "", + [string] $insiderSasToken = "", + [switch] $fromVSCode +) + +$ErrorActionPreference = "stop" +Set-StrictMode -Version 2.0 + +$pshost = Get-Host +if ($pshost.Name -eq "Visual Studio Code Host") { + $executionPolicy = Get-ExecutionPolicy -Scope CurrentUser + Write-Host "Execution Policy is $executionPolicy" + if ($executionPolicy -eq "Restricted") { + Write-Host "Changing Execution Policy to RemoteSigned" + Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser -Force + } + if ($MyInvocation.InvocationName -eq '.' -or $MyInvocation.Line -eq '') { + $scriptName = Join-Path $PSScriptRoot $MyInvocation.MyCommand + } + else { + $scriptName = $MyInvocation.InvocationName + } + if (Test-Path -Path $scriptName -PathType Leaf) { + $scriptName = (Get-Item -path $scriptName).FullName + $pslink = Join-Path $env:APPDATA "Microsoft\Windows\Start Menu\Programs\Windows PowerShell\Windows PowerShell.lnk" + if (!(Test-Path $pslink)) { + $pslink = "powershell.exe" + } + $credstr = "" + if ($credential) { + $credstr = " -credential (New-Object PSCredential '$($credential.UserName)', ('$($credential.Password | ConvertFrom-SecureString)' | ConvertTo-SecureString))" + } + Start-Process -Verb runas $pslink @("-Command ""$scriptName"" -fromVSCode -containerName '$containerName' -auth '$auth' -licenseFileUrl '$licenseFileUrl' -insiderSasToken '$insiderSasToken'$credstr") + return + } +} + +try { +$webClient = New-Object System.Net.WebClient +$webClient.CachePolicy = New-Object System.Net.Cache.RequestCachePolicy -argumentList ([System.Net.Cache.RequestCacheLevel]::NoCacheNoStore) +$webClient.Encoding = [System.Text.Encoding]::UTF8 +Write-Host "Downloading GitHub Helper module" +$GitHubHelperPath = "$([System.IO.Path]::GetTempFileName()).psm1" +$webClient.DownloadFile('https://raw.githubusercontent.com/freddydk/AL-Go-Actions/main/Github-Helper.psm1', $GitHubHelperPath) +Write-Host "Downloading AL-Go Helper script" +$ALGoHelperPath = "$([System.IO.Path]::GetTempFileName()).ps1" +$webClient.DownloadFile('https://raw.githubusercontent.com/freddydk/AL-Go-Actions/main/AL-Go-Helper.ps1', $ALGoHelperPath) + +Import-Module $GitHubHelperPath +. $ALGoHelperPath -local + +$baseFolder = Join-Path $PSScriptRoot ".." -Resolve + +Clear-Host +Write-Host -ForegroundColor Yellow @' + _ _ _____ ______ + | | | | | __ \ | ____| + | | ___ ___ __ _| | | | | | _____ __ |__ _ ____ __ + | | / _ \ / __/ _` | | | | | |/ _ \ \ / / __| | '_ \ \ / / + | |____ (_) | (__ (_| | | | |__| | __/\ V /| |____| | | \ V / + |______\___/ \___\__,_|_| |_____/ \___| \_/ |______|_| |_|\_/ + +'@ + +Write-Host @' +This script will create a docker based local development environment for your project. + +NOTE: You need to have Docker installed, configured and be able to create Business Central containers for this to work. +If this fails, you can setup a cloud based development environment by running cloudDevEnv.ps1 + +All apps and test apps will be compiled and published to the environment in the development scope. +The script will also modify launch.json to have a Local Sandbox configuration point to your environment. + +'@ + +$settings = ReadSettings -baseFolder $baseFolder -userName $env:USERNAME + +Write-Host "Checking System Requirements" +$dockerProcess = (Get-Process "dockerd" -ErrorAction Ignore) +if (!($dockerProcess)) { + Write-Host -ForegroundColor Red "Dockerd process not found. Docker might not be started, not installed or not running Windows Containers." +} +if ($settings.keyVaultName) { + if (-not (Get-Module -ListAvailable -Name 'Az.KeyVault')) { + Write-Host -ForegroundColor Red "A keyvault name is defined in Settings, you need to have the Az.KeyVault PowerShell module installed (use Install-Module az) or you can set the keyVaultName to an empty string in the user settings file ($($ENV:UserName).Settings.json)." + } +} + +Write-Host + +if (-not $containerName) { + $containerName = Enter-Value ` + -title "Container name" ` + -question "Please enter the name of the container to create" ` + -default "bcserver" +} + +if (-not $auth) { + $auth = Select-Value ` + -title "Authentication mechanism for container" ` + -options @{ "Windows" = "Windows Authentication"; "UserPassword" = "Username/Password authentication" } ` + -question "Select authentication mechanism for container" ` + -default "UserPassword" +} + +if (-not $credential) { + if ($auth -eq "Windows") { + $credential = Get-Credential -Message "Please enter your Windows Credentials" -UserName $env:USERNAME + $CurrentDomain = "LDAP://" + ([ADSI]"").distinguishedName + $domain = New-Object System.DirectoryServices.DirectoryEntry($CurrentDomain,$credential.UserName,$credential.GetNetworkCredential().password) + if ($null -eq $domain.name) { + Write-Host -ForegroundColor Red "Unable to verify your Windows Credentials, you might not be able to authenticate to your container" + } + } + else { + $credential = Get-Credential -Message "Please enter username and password for your container" -UserName "admin" + } +} + +if (-not $licenseFileUrl) { + if ($settings.type -eq "AppSource App") { + $description = "When developing AppSource Apps, your local development environment needs the developer licensefile with permissions to your AppSource app object IDs" + $default = "" + } + else { + $description = "When developing PTEs, you can optionally specify a developer licensefile with permissions to object IDs of your dependant apps" + $default = "none" + } + + $licenseFileUrl = Enter-Value ` + -title "LicenseFileUrl" ` + -description $description ` + -question "Local path or a secure download URL to license file " ` + -default $default + + if ($licenseFileUrl -eq "none") { + $licenseFileUrl = "" + } +} + +CreateDevEnv ` + -kind local ` + -caller local ` + -containerName $containerName ` + -baseFolder $baseFolder ` + -auth $auth ` + -credential $credential ` + -LicenseFileUrl $licenseFileUrl ` + -InsiderSasToken $insiderSasToken +} +catch { + Write-Host -ForegroundColor Red "Error: $($_.Exception.Message)`nStacktrace: $($_.scriptStackTrace)" +} +finally { + if ($fromVSCode) { + Read-Host "Press ENTER to close this window" + } +} diff --git a/BO-IT/.AL-Go/cloudDevEnv.ps1 b/BO-IT/.AL-Go/cloudDevEnv.ps1 new file mode 100644 index 0000000..98f7a6e --- /dev/null +++ b/BO-IT/.AL-Go/cloudDevEnv.ps1 @@ -0,0 +1,106 @@ +# +# 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 +# +Param( + [string] $environmentName = "", + [bool] $reuseExistingEnvironment, + [switch] $fromVSCode +) + +$ErrorActionPreference = "stop" +Set-StrictMode -Version 2.0 + +$pshost = Get-Host +if ($pshost.Name -eq "Visual Studio Code Host") { + $executionPolicy = Get-ExecutionPolicy -Scope CurrentUser + Write-Host "Execution Policy is $executionPolicy" + if ($executionPolicy -eq "Restricted") { + Write-Host "Changing Execution Policy to RemoteSigned" + Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser -Force + } + if ($MyInvocation.InvocationName -eq '.' -or $MyInvocation.Line -eq '') { + $scriptName = Join-Path $PSScriptRoot $MyInvocation.MyCommand + } + else { + $scriptName = $MyInvocation.InvocationName + } + if (Test-Path -Path $scriptName -PathType Leaf) { + $scriptName = (Get-Item -path $scriptName).FullName + $pslink = Join-Path $env:APPDATA "Microsoft\Windows\Start Menu\Programs\Windows PowerShell\Windows PowerShell.lnk" + if (!(Test-Path $pslink)) { + $pslink = "powershell.exe" + } + Start-Process -Verb runas $pslink @("-Command ""$scriptName"" -fromVSCode -environmentName '$environmentName' -reuseExistingEnvironment `$$reuseExistingEnvironment") + return + } +} + +try { +$ALGoHelperPath = "$([System.IO.Path]::GetTempFileName()).ps1" +$webClient = New-Object System.Net.WebClient +$webClient.CachePolicy = New-Object System.Net.Cache.RequestCachePolicy -argumentList ([System.Net.Cache.RequestCacheLevel]::NoCacheNoStore) +$webClient.Encoding = [System.Text.Encoding]::UTF8 +Write-Host "Downloading AL-Go Helper script" +$webClient.DownloadFile('https://raw.githubusercontent.com/freddydk/AL-Go-Actions/main/AL-Go-Helper.ps1', $ALGoHelperPath) +. $ALGoHelperPath -local + +$baseFolder = Join-Path $PSScriptRoot ".." -Resolve + +Clear-Host +Write-Host -ForegroundColor Yellow @' + _____ _ _ _____ ______ + / ____| | | | | __ \ | ____| + | | | | ___ _ _ __| | | | | | _____ __ |__ _ ____ __ + | | | |/ _ \| | | |/ _` | | | | |/ _ \ \ / / __| | '_ \ \ / / + | |____| | (_) | |_| | (_| | | |__| | __/\ V /| |____| | | \ V / + \_____|_|\___/ \__,_|\__,_| |_____/ \___| \_/ |______|_| |_|\_/ + +'@ + +Write-Host @' +This script will create a cloud based development environment (Business Central SaaS Sandbox) for your project. +All apps and test apps will be compiled and published to the environment in the development scope. +The script will also modify launch.json to have a "Cloud Sandbox ()" configuration point to your environment. + +'@ + +if (Test-Path (Join-Path $PSScriptRoot "NewBcContainer.ps1")) { + Write-Host -ForegroundColor Red "WARNING: The project has a NewBcContainer override defined. Typically, this means that you cannot run a cloud development environment" +} + +$settings = ReadSettings -baseFolder $baseFolder -userName $env:USERNAME + +Write-Host + +if (-not $environmentName) { + $environmentName = Enter-Value ` + -title "Environment name" ` + -question "Please enter the name of the environment to create" ` + -default "$($env:USERNAME)-sandbox" +} + +if (-not $PSBoundParameters.ContainsKey('reuseExistingEnvironment')) { + $reuseExistingEnvironment = (Select-Value ` + -title "What if the environment already exists?" ` + -options @{ "Yes" = "Reuse existing environment"; "No" = "Recreate environment" } ` + -question "Select behavior" ` + -default "No") -eq "Yes" +} + +CreateDevEnv ` + -kind cloud ` + -caller local ` + -environmentName $environmentName ` + -reuseExistingEnvironment:$reuseExistingEnvironment ` + -baseFolder $baseFolder +} +catch { + Write-Host -ForegroundColor Red "Error: $($_.Exception.Message)`nStacktrace: $($_.scriptStackTrace)" +} +finally { + if ($fromVSCode) { + Read-Host "Press ENTER to close this window" + } +} diff --git a/BO-IT/.AL-Go/localDevEnv.ps1 b/BO-IT/.AL-Go/localDevEnv.ps1 new file mode 100644 index 0000000..1502393 --- /dev/null +++ b/BO-IT/.AL-Go/localDevEnv.ps1 @@ -0,0 +1,167 @@ +# +# 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 +# +Param( + [string] $containerName = "", + [string] $auth = "", + [pscredential] $credential = $null, + [string] $licenseFileUrl = "", + [string] $insiderSasToken = "", + [switch] $fromVSCode +) + +$ErrorActionPreference = "stop" +Set-StrictMode -Version 2.0 + +$pshost = Get-Host +if ($pshost.Name -eq "Visual Studio Code Host") { + $executionPolicy = Get-ExecutionPolicy -Scope CurrentUser + Write-Host "Execution Policy is $executionPolicy" + if ($executionPolicy -eq "Restricted") { + Write-Host "Changing Execution Policy to RemoteSigned" + Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser -Force + } + if ($MyInvocation.InvocationName -eq '.' -or $MyInvocation.Line -eq '') { + $scriptName = Join-Path $PSScriptRoot $MyInvocation.MyCommand + } + else { + $scriptName = $MyInvocation.InvocationName + } + if (Test-Path -Path $scriptName -PathType Leaf) { + $scriptName = (Get-Item -path $scriptName).FullName + $pslink = Join-Path $env:APPDATA "Microsoft\Windows\Start Menu\Programs\Windows PowerShell\Windows PowerShell.lnk" + if (!(Test-Path $pslink)) { + $pslink = "powershell.exe" + } + $credstr = "" + if ($credential) { + $credstr = " -credential (New-Object PSCredential '$($credential.UserName)', ('$($credential.Password | ConvertFrom-SecureString)' | ConvertTo-SecureString))" + } + Start-Process -Verb runas $pslink @("-Command ""$scriptName"" -fromVSCode -containerName '$containerName' -auth '$auth' -licenseFileUrl '$licenseFileUrl' -insiderSasToken '$insiderSasToken'$credstr") + return + } +} + +try { +$webClient = New-Object System.Net.WebClient +$webClient.CachePolicy = New-Object System.Net.Cache.RequestCachePolicy -argumentList ([System.Net.Cache.RequestCacheLevel]::NoCacheNoStore) +$webClient.Encoding = [System.Text.Encoding]::UTF8 +Write-Host "Downloading GitHub Helper module" +$GitHubHelperPath = "$([System.IO.Path]::GetTempFileName()).psm1" +$webClient.DownloadFile('https://raw.githubusercontent.com/freddydk/AL-Go-Actions/main/Github-Helper.psm1', $GitHubHelperPath) +Write-Host "Downloading AL-Go Helper script" +$ALGoHelperPath = "$([System.IO.Path]::GetTempFileName()).ps1" +$webClient.DownloadFile('https://raw.githubusercontent.com/freddydk/AL-Go-Actions/main/AL-Go-Helper.ps1', $ALGoHelperPath) + +Import-Module $GitHubHelperPath +. $ALGoHelperPath -local + +$baseFolder = Join-Path $PSScriptRoot ".." -Resolve + +Clear-Host +Write-Host -ForegroundColor Yellow @' + _ _ _____ ______ + | | | | | __ \ | ____| + | | ___ ___ __ _| | | | | | _____ __ |__ _ ____ __ + | | / _ \ / __/ _` | | | | | |/ _ \ \ / / __| | '_ \ \ / / + | |____ (_) | (__ (_| | | | |__| | __/\ V /| |____| | | \ V / + |______\___/ \___\__,_|_| |_____/ \___| \_/ |______|_| |_|\_/ + +'@ + +Write-Host @' +This script will create a docker based local development environment for your project. + +NOTE: You need to have Docker installed, configured and be able to create Business Central containers for this to work. +If this fails, you can setup a cloud based development environment by running cloudDevEnv.ps1 + +All apps and test apps will be compiled and published to the environment in the development scope. +The script will also modify launch.json to have a Local Sandbox configuration point to your environment. + +'@ + +$settings = ReadSettings -baseFolder $baseFolder -userName $env:USERNAME + +Write-Host "Checking System Requirements" +$dockerProcess = (Get-Process "dockerd" -ErrorAction Ignore) +if (!($dockerProcess)) { + Write-Host -ForegroundColor Red "Dockerd process not found. Docker might not be started, not installed or not running Windows Containers." +} +if ($settings.keyVaultName) { + if (-not (Get-Module -ListAvailable -Name 'Az.KeyVault')) { + Write-Host -ForegroundColor Red "A keyvault name is defined in Settings, you need to have the Az.KeyVault PowerShell module installed (use Install-Module az) or you can set the keyVaultName to an empty string in the user settings file ($($ENV:UserName).Settings.json)." + } +} + +Write-Host + +if (-not $containerName) { + $containerName = Enter-Value ` + -title "Container name" ` + -question "Please enter the name of the container to create" ` + -default "bcserver" +} + +if (-not $auth) { + $auth = Select-Value ` + -title "Authentication mechanism for container" ` + -options @{ "Windows" = "Windows Authentication"; "UserPassword" = "Username/Password authentication" } ` + -question "Select authentication mechanism for container" ` + -default "UserPassword" +} + +if (-not $credential) { + if ($auth -eq "Windows") { + $credential = Get-Credential -Message "Please enter your Windows Credentials" -UserName $env:USERNAME + $CurrentDomain = "LDAP://" + ([ADSI]"").distinguishedName + $domain = New-Object System.DirectoryServices.DirectoryEntry($CurrentDomain,$credential.UserName,$credential.GetNetworkCredential().password) + if ($null -eq $domain.name) { + Write-Host -ForegroundColor Red "Unable to verify your Windows Credentials, you might not be able to authenticate to your container" + } + } + else { + $credential = Get-Credential -Message "Please enter username and password for your container" -UserName "admin" + } +} + +if (-not $licenseFileUrl) { + if ($settings.type -eq "AppSource App") { + $description = "When developing AppSource Apps, your local development environment needs the developer licensefile with permissions to your AppSource app object IDs" + $default = "" + } + else { + $description = "When developing PTEs, you can optionally specify a developer licensefile with permissions to object IDs of your dependant apps" + $default = "none" + } + + $licenseFileUrl = Enter-Value ` + -title "LicenseFileUrl" ` + -description $description ` + -question "Local path or a secure download URL to license file " ` + -default $default + + if ($licenseFileUrl -eq "none") { + $licenseFileUrl = "" + } +} + +CreateDevEnv ` + -kind local ` + -caller local ` + -containerName $containerName ` + -baseFolder $baseFolder ` + -auth $auth ` + -credential $credential ` + -LicenseFileUrl $licenseFileUrl ` + -InsiderSasToken $insiderSasToken +} +catch { + Write-Host -ForegroundColor Red "Error: $($_.Exception.Message)`nStacktrace: $($_.scriptStackTrace)" +} +finally { + if ($fromVSCode) { + Read-Host "Press ENTER to close this window" + } +} diff --git a/BO-W1/.AL-Go/cloudDevEnv.ps1 b/BO-W1/.AL-Go/cloudDevEnv.ps1 new file mode 100644 index 0000000..98f7a6e --- /dev/null +++ b/BO-W1/.AL-Go/cloudDevEnv.ps1 @@ -0,0 +1,106 @@ +# +# 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 +# +Param( + [string] $environmentName = "", + [bool] $reuseExistingEnvironment, + [switch] $fromVSCode +) + +$ErrorActionPreference = "stop" +Set-StrictMode -Version 2.0 + +$pshost = Get-Host +if ($pshost.Name -eq "Visual Studio Code Host") { + $executionPolicy = Get-ExecutionPolicy -Scope CurrentUser + Write-Host "Execution Policy is $executionPolicy" + if ($executionPolicy -eq "Restricted") { + Write-Host "Changing Execution Policy to RemoteSigned" + Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser -Force + } + if ($MyInvocation.InvocationName -eq '.' -or $MyInvocation.Line -eq '') { + $scriptName = Join-Path $PSScriptRoot $MyInvocation.MyCommand + } + else { + $scriptName = $MyInvocation.InvocationName + } + if (Test-Path -Path $scriptName -PathType Leaf) { + $scriptName = (Get-Item -path $scriptName).FullName + $pslink = Join-Path $env:APPDATA "Microsoft\Windows\Start Menu\Programs\Windows PowerShell\Windows PowerShell.lnk" + if (!(Test-Path $pslink)) { + $pslink = "powershell.exe" + } + Start-Process -Verb runas $pslink @("-Command ""$scriptName"" -fromVSCode -environmentName '$environmentName' -reuseExistingEnvironment `$$reuseExistingEnvironment") + return + } +} + +try { +$ALGoHelperPath = "$([System.IO.Path]::GetTempFileName()).ps1" +$webClient = New-Object System.Net.WebClient +$webClient.CachePolicy = New-Object System.Net.Cache.RequestCachePolicy -argumentList ([System.Net.Cache.RequestCacheLevel]::NoCacheNoStore) +$webClient.Encoding = [System.Text.Encoding]::UTF8 +Write-Host "Downloading AL-Go Helper script" +$webClient.DownloadFile('https://raw.githubusercontent.com/freddydk/AL-Go-Actions/main/AL-Go-Helper.ps1', $ALGoHelperPath) +. $ALGoHelperPath -local + +$baseFolder = Join-Path $PSScriptRoot ".." -Resolve + +Clear-Host +Write-Host -ForegroundColor Yellow @' + _____ _ _ _____ ______ + / ____| | | | | __ \ | ____| + | | | | ___ _ _ __| | | | | | _____ __ |__ _ ____ __ + | | | |/ _ \| | | |/ _` | | | | |/ _ \ \ / / __| | '_ \ \ / / + | |____| | (_) | |_| | (_| | | |__| | __/\ V /| |____| | | \ V / + \_____|_|\___/ \__,_|\__,_| |_____/ \___| \_/ |______|_| |_|\_/ + +'@ + +Write-Host @' +This script will create a cloud based development environment (Business Central SaaS Sandbox) for your project. +All apps and test apps will be compiled and published to the environment in the development scope. +The script will also modify launch.json to have a "Cloud Sandbox ()" configuration point to your environment. + +'@ + +if (Test-Path (Join-Path $PSScriptRoot "NewBcContainer.ps1")) { + Write-Host -ForegroundColor Red "WARNING: The project has a NewBcContainer override defined. Typically, this means that you cannot run a cloud development environment" +} + +$settings = ReadSettings -baseFolder $baseFolder -userName $env:USERNAME + +Write-Host + +if (-not $environmentName) { + $environmentName = Enter-Value ` + -title "Environment name" ` + -question "Please enter the name of the environment to create" ` + -default "$($env:USERNAME)-sandbox" +} + +if (-not $PSBoundParameters.ContainsKey('reuseExistingEnvironment')) { + $reuseExistingEnvironment = (Select-Value ` + -title "What if the environment already exists?" ` + -options @{ "Yes" = "Reuse existing environment"; "No" = "Recreate environment" } ` + -question "Select behavior" ` + -default "No") -eq "Yes" +} + +CreateDevEnv ` + -kind cloud ` + -caller local ` + -environmentName $environmentName ` + -reuseExistingEnvironment:$reuseExistingEnvironment ` + -baseFolder $baseFolder +} +catch { + Write-Host -ForegroundColor Red "Error: $($_.Exception.Message)`nStacktrace: $($_.scriptStackTrace)" +} +finally { + if ($fromVSCode) { + Read-Host "Press ENTER to close this window" + } +} diff --git a/BO-W1/.AL-Go/localDevEnv.ps1 b/BO-W1/.AL-Go/localDevEnv.ps1 new file mode 100644 index 0000000..1502393 --- /dev/null +++ b/BO-W1/.AL-Go/localDevEnv.ps1 @@ -0,0 +1,167 @@ +# +# 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 +# +Param( + [string] $containerName = "", + [string] $auth = "", + [pscredential] $credential = $null, + [string] $licenseFileUrl = "", + [string] $insiderSasToken = "", + [switch] $fromVSCode +) + +$ErrorActionPreference = "stop" +Set-StrictMode -Version 2.0 + +$pshost = Get-Host +if ($pshost.Name -eq "Visual Studio Code Host") { + $executionPolicy = Get-ExecutionPolicy -Scope CurrentUser + Write-Host "Execution Policy is $executionPolicy" + if ($executionPolicy -eq "Restricted") { + Write-Host "Changing Execution Policy to RemoteSigned" + Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser -Force + } + if ($MyInvocation.InvocationName -eq '.' -or $MyInvocation.Line -eq '') { + $scriptName = Join-Path $PSScriptRoot $MyInvocation.MyCommand + } + else { + $scriptName = $MyInvocation.InvocationName + } + if (Test-Path -Path $scriptName -PathType Leaf) { + $scriptName = (Get-Item -path $scriptName).FullName + $pslink = Join-Path $env:APPDATA "Microsoft\Windows\Start Menu\Programs\Windows PowerShell\Windows PowerShell.lnk" + if (!(Test-Path $pslink)) { + $pslink = "powershell.exe" + } + $credstr = "" + if ($credential) { + $credstr = " -credential (New-Object PSCredential '$($credential.UserName)', ('$($credential.Password | ConvertFrom-SecureString)' | ConvertTo-SecureString))" + } + Start-Process -Verb runas $pslink @("-Command ""$scriptName"" -fromVSCode -containerName '$containerName' -auth '$auth' -licenseFileUrl '$licenseFileUrl' -insiderSasToken '$insiderSasToken'$credstr") + return + } +} + +try { +$webClient = New-Object System.Net.WebClient +$webClient.CachePolicy = New-Object System.Net.Cache.RequestCachePolicy -argumentList ([System.Net.Cache.RequestCacheLevel]::NoCacheNoStore) +$webClient.Encoding = [System.Text.Encoding]::UTF8 +Write-Host "Downloading GitHub Helper module" +$GitHubHelperPath = "$([System.IO.Path]::GetTempFileName()).psm1" +$webClient.DownloadFile('https://raw.githubusercontent.com/freddydk/AL-Go-Actions/main/Github-Helper.psm1', $GitHubHelperPath) +Write-Host "Downloading AL-Go Helper script" +$ALGoHelperPath = "$([System.IO.Path]::GetTempFileName()).ps1" +$webClient.DownloadFile('https://raw.githubusercontent.com/freddydk/AL-Go-Actions/main/AL-Go-Helper.ps1', $ALGoHelperPath) + +Import-Module $GitHubHelperPath +. $ALGoHelperPath -local + +$baseFolder = Join-Path $PSScriptRoot ".." -Resolve + +Clear-Host +Write-Host -ForegroundColor Yellow @' + _ _ _____ ______ + | | | | | __ \ | ____| + | | ___ ___ __ _| | | | | | _____ __ |__ _ ____ __ + | | / _ \ / __/ _` | | | | | |/ _ \ \ / / __| | '_ \ \ / / + | |____ (_) | (__ (_| | | | |__| | __/\ V /| |____| | | \ V / + |______\___/ \___\__,_|_| |_____/ \___| \_/ |______|_| |_|\_/ + +'@ + +Write-Host @' +This script will create a docker based local development environment for your project. + +NOTE: You need to have Docker installed, configured and be able to create Business Central containers for this to work. +If this fails, you can setup a cloud based development environment by running cloudDevEnv.ps1 + +All apps and test apps will be compiled and published to the environment in the development scope. +The script will also modify launch.json to have a Local Sandbox configuration point to your environment. + +'@ + +$settings = ReadSettings -baseFolder $baseFolder -userName $env:USERNAME + +Write-Host "Checking System Requirements" +$dockerProcess = (Get-Process "dockerd" -ErrorAction Ignore) +if (!($dockerProcess)) { + Write-Host -ForegroundColor Red "Dockerd process not found. Docker might not be started, not installed or not running Windows Containers." +} +if ($settings.keyVaultName) { + if (-not (Get-Module -ListAvailable -Name 'Az.KeyVault')) { + Write-Host -ForegroundColor Red "A keyvault name is defined in Settings, you need to have the Az.KeyVault PowerShell module installed (use Install-Module az) or you can set the keyVaultName to an empty string in the user settings file ($($ENV:UserName).Settings.json)." + } +} + +Write-Host + +if (-not $containerName) { + $containerName = Enter-Value ` + -title "Container name" ` + -question "Please enter the name of the container to create" ` + -default "bcserver" +} + +if (-not $auth) { + $auth = Select-Value ` + -title "Authentication mechanism for container" ` + -options @{ "Windows" = "Windows Authentication"; "UserPassword" = "Username/Password authentication" } ` + -question "Select authentication mechanism for container" ` + -default "UserPassword" +} + +if (-not $credential) { + if ($auth -eq "Windows") { + $credential = Get-Credential -Message "Please enter your Windows Credentials" -UserName $env:USERNAME + $CurrentDomain = "LDAP://" + ([ADSI]"").distinguishedName + $domain = New-Object System.DirectoryServices.DirectoryEntry($CurrentDomain,$credential.UserName,$credential.GetNetworkCredential().password) + if ($null -eq $domain.name) { + Write-Host -ForegroundColor Red "Unable to verify your Windows Credentials, you might not be able to authenticate to your container" + } + } + else { + $credential = Get-Credential -Message "Please enter username and password for your container" -UserName "admin" + } +} + +if (-not $licenseFileUrl) { + if ($settings.type -eq "AppSource App") { + $description = "When developing AppSource Apps, your local development environment needs the developer licensefile with permissions to your AppSource app object IDs" + $default = "" + } + else { + $description = "When developing PTEs, you can optionally specify a developer licensefile with permissions to object IDs of your dependant apps" + $default = "none" + } + + $licenseFileUrl = Enter-Value ` + -title "LicenseFileUrl" ` + -description $description ` + -question "Local path or a secure download URL to license file " ` + -default $default + + if ($licenseFileUrl -eq "none") { + $licenseFileUrl = "" + } +} + +CreateDevEnv ` + -kind local ` + -caller local ` + -containerName $containerName ` + -baseFolder $baseFolder ` + -auth $auth ` + -credential $credential ` + -LicenseFileUrl $licenseFileUrl ` + -InsiderSasToken $insiderSasToken +} +catch { + Write-Host -ForegroundColor Red "Error: $($_.Exception.Message)`nStacktrace: $($_.scriptStackTrace)" +} +finally { + if ($fromVSCode) { + Read-Host "Press ENTER to close this window" + } +} diff --git a/Misc/.AL-Go/cloudDevEnv.ps1 b/Misc/.AL-Go/cloudDevEnv.ps1 new file mode 100644 index 0000000..98f7a6e --- /dev/null +++ b/Misc/.AL-Go/cloudDevEnv.ps1 @@ -0,0 +1,106 @@ +# +# 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 +# +Param( + [string] $environmentName = "", + [bool] $reuseExistingEnvironment, + [switch] $fromVSCode +) + +$ErrorActionPreference = "stop" +Set-StrictMode -Version 2.0 + +$pshost = Get-Host +if ($pshost.Name -eq "Visual Studio Code Host") { + $executionPolicy = Get-ExecutionPolicy -Scope CurrentUser + Write-Host "Execution Policy is $executionPolicy" + if ($executionPolicy -eq "Restricted") { + Write-Host "Changing Execution Policy to RemoteSigned" + Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser -Force + } + if ($MyInvocation.InvocationName -eq '.' -or $MyInvocation.Line -eq '') { + $scriptName = Join-Path $PSScriptRoot $MyInvocation.MyCommand + } + else { + $scriptName = $MyInvocation.InvocationName + } + if (Test-Path -Path $scriptName -PathType Leaf) { + $scriptName = (Get-Item -path $scriptName).FullName + $pslink = Join-Path $env:APPDATA "Microsoft\Windows\Start Menu\Programs\Windows PowerShell\Windows PowerShell.lnk" + if (!(Test-Path $pslink)) { + $pslink = "powershell.exe" + } + Start-Process -Verb runas $pslink @("-Command ""$scriptName"" -fromVSCode -environmentName '$environmentName' -reuseExistingEnvironment `$$reuseExistingEnvironment") + return + } +} + +try { +$ALGoHelperPath = "$([System.IO.Path]::GetTempFileName()).ps1" +$webClient = New-Object System.Net.WebClient +$webClient.CachePolicy = New-Object System.Net.Cache.RequestCachePolicy -argumentList ([System.Net.Cache.RequestCacheLevel]::NoCacheNoStore) +$webClient.Encoding = [System.Text.Encoding]::UTF8 +Write-Host "Downloading AL-Go Helper script" +$webClient.DownloadFile('https://raw.githubusercontent.com/freddydk/AL-Go-Actions/main/AL-Go-Helper.ps1', $ALGoHelperPath) +. $ALGoHelperPath -local + +$baseFolder = Join-Path $PSScriptRoot ".." -Resolve + +Clear-Host +Write-Host -ForegroundColor Yellow @' + _____ _ _ _____ ______ + / ____| | | | | __ \ | ____| + | | | | ___ _ _ __| | | | | | _____ __ |__ _ ____ __ + | | | |/ _ \| | | |/ _` | | | | |/ _ \ \ / / __| | '_ \ \ / / + | |____| | (_) | |_| | (_| | | |__| | __/\ V /| |____| | | \ V / + \_____|_|\___/ \__,_|\__,_| |_____/ \___| \_/ |______|_| |_|\_/ + +'@ + +Write-Host @' +This script will create a cloud based development environment (Business Central SaaS Sandbox) for your project. +All apps and test apps will be compiled and published to the environment in the development scope. +The script will also modify launch.json to have a "Cloud Sandbox ()" configuration point to your environment. + +'@ + +if (Test-Path (Join-Path $PSScriptRoot "NewBcContainer.ps1")) { + Write-Host -ForegroundColor Red "WARNING: The project has a NewBcContainer override defined. Typically, this means that you cannot run a cloud development environment" +} + +$settings = ReadSettings -baseFolder $baseFolder -userName $env:USERNAME + +Write-Host + +if (-not $environmentName) { + $environmentName = Enter-Value ` + -title "Environment name" ` + -question "Please enter the name of the environment to create" ` + -default "$($env:USERNAME)-sandbox" +} + +if (-not $PSBoundParameters.ContainsKey('reuseExistingEnvironment')) { + $reuseExistingEnvironment = (Select-Value ` + -title "What if the environment already exists?" ` + -options @{ "Yes" = "Reuse existing environment"; "No" = "Recreate environment" } ` + -question "Select behavior" ` + -default "No") -eq "Yes" +} + +CreateDevEnv ` + -kind cloud ` + -caller local ` + -environmentName $environmentName ` + -reuseExistingEnvironment:$reuseExistingEnvironment ` + -baseFolder $baseFolder +} +catch { + Write-Host -ForegroundColor Red "Error: $($_.Exception.Message)`nStacktrace: $($_.scriptStackTrace)" +} +finally { + if ($fromVSCode) { + Read-Host "Press ENTER to close this window" + } +} diff --git a/Misc/.AL-Go/localDevEnv.ps1 b/Misc/.AL-Go/localDevEnv.ps1 new file mode 100644 index 0000000..1502393 --- /dev/null +++ b/Misc/.AL-Go/localDevEnv.ps1 @@ -0,0 +1,167 @@ +# +# 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 +# +Param( + [string] $containerName = "", + [string] $auth = "", + [pscredential] $credential = $null, + [string] $licenseFileUrl = "", + [string] $insiderSasToken = "", + [switch] $fromVSCode +) + +$ErrorActionPreference = "stop" +Set-StrictMode -Version 2.0 + +$pshost = Get-Host +if ($pshost.Name -eq "Visual Studio Code Host") { + $executionPolicy = Get-ExecutionPolicy -Scope CurrentUser + Write-Host "Execution Policy is $executionPolicy" + if ($executionPolicy -eq "Restricted") { + Write-Host "Changing Execution Policy to RemoteSigned" + Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser -Force + } + if ($MyInvocation.InvocationName -eq '.' -or $MyInvocation.Line -eq '') { + $scriptName = Join-Path $PSScriptRoot $MyInvocation.MyCommand + } + else { + $scriptName = $MyInvocation.InvocationName + } + if (Test-Path -Path $scriptName -PathType Leaf) { + $scriptName = (Get-Item -path $scriptName).FullName + $pslink = Join-Path $env:APPDATA "Microsoft\Windows\Start Menu\Programs\Windows PowerShell\Windows PowerShell.lnk" + if (!(Test-Path $pslink)) { + $pslink = "powershell.exe" + } + $credstr = "" + if ($credential) { + $credstr = " -credential (New-Object PSCredential '$($credential.UserName)', ('$($credential.Password | ConvertFrom-SecureString)' | ConvertTo-SecureString))" + } + Start-Process -Verb runas $pslink @("-Command ""$scriptName"" -fromVSCode -containerName '$containerName' -auth '$auth' -licenseFileUrl '$licenseFileUrl' -insiderSasToken '$insiderSasToken'$credstr") + return + } +} + +try { +$webClient = New-Object System.Net.WebClient +$webClient.CachePolicy = New-Object System.Net.Cache.RequestCachePolicy -argumentList ([System.Net.Cache.RequestCacheLevel]::NoCacheNoStore) +$webClient.Encoding = [System.Text.Encoding]::UTF8 +Write-Host "Downloading GitHub Helper module" +$GitHubHelperPath = "$([System.IO.Path]::GetTempFileName()).psm1" +$webClient.DownloadFile('https://raw.githubusercontent.com/freddydk/AL-Go-Actions/main/Github-Helper.psm1', $GitHubHelperPath) +Write-Host "Downloading AL-Go Helper script" +$ALGoHelperPath = "$([System.IO.Path]::GetTempFileName()).ps1" +$webClient.DownloadFile('https://raw.githubusercontent.com/freddydk/AL-Go-Actions/main/AL-Go-Helper.ps1', $ALGoHelperPath) + +Import-Module $GitHubHelperPath +. $ALGoHelperPath -local + +$baseFolder = Join-Path $PSScriptRoot ".." -Resolve + +Clear-Host +Write-Host -ForegroundColor Yellow @' + _ _ _____ ______ + | | | | | __ \ | ____| + | | ___ ___ __ _| | | | | | _____ __ |__ _ ____ __ + | | / _ \ / __/ _` | | | | | |/ _ \ \ / / __| | '_ \ \ / / + | |____ (_) | (__ (_| | | | |__| | __/\ V /| |____| | | \ V / + |______\___/ \___\__,_|_| |_____/ \___| \_/ |______|_| |_|\_/ + +'@ + +Write-Host @' +This script will create a docker based local development environment for your project. + +NOTE: You need to have Docker installed, configured and be able to create Business Central containers for this to work. +If this fails, you can setup a cloud based development environment by running cloudDevEnv.ps1 + +All apps and test apps will be compiled and published to the environment in the development scope. +The script will also modify launch.json to have a Local Sandbox configuration point to your environment. + +'@ + +$settings = ReadSettings -baseFolder $baseFolder -userName $env:USERNAME + +Write-Host "Checking System Requirements" +$dockerProcess = (Get-Process "dockerd" -ErrorAction Ignore) +if (!($dockerProcess)) { + Write-Host -ForegroundColor Red "Dockerd process not found. Docker might not be started, not installed or not running Windows Containers." +} +if ($settings.keyVaultName) { + if (-not (Get-Module -ListAvailable -Name 'Az.KeyVault')) { + Write-Host -ForegroundColor Red "A keyvault name is defined in Settings, you need to have the Az.KeyVault PowerShell module installed (use Install-Module az) or you can set the keyVaultName to an empty string in the user settings file ($($ENV:UserName).Settings.json)." + } +} + +Write-Host + +if (-not $containerName) { + $containerName = Enter-Value ` + -title "Container name" ` + -question "Please enter the name of the container to create" ` + -default "bcserver" +} + +if (-not $auth) { + $auth = Select-Value ` + -title "Authentication mechanism for container" ` + -options @{ "Windows" = "Windows Authentication"; "UserPassword" = "Username/Password authentication" } ` + -question "Select authentication mechanism for container" ` + -default "UserPassword" +} + +if (-not $credential) { + if ($auth -eq "Windows") { + $credential = Get-Credential -Message "Please enter your Windows Credentials" -UserName $env:USERNAME + $CurrentDomain = "LDAP://" + ([ADSI]"").distinguishedName + $domain = New-Object System.DirectoryServices.DirectoryEntry($CurrentDomain,$credential.UserName,$credential.GetNetworkCredential().password) + if ($null -eq $domain.name) { + Write-Host -ForegroundColor Red "Unable to verify your Windows Credentials, you might not be able to authenticate to your container" + } + } + else { + $credential = Get-Credential -Message "Please enter username and password for your container" -UserName "admin" + } +} + +if (-not $licenseFileUrl) { + if ($settings.type -eq "AppSource App") { + $description = "When developing AppSource Apps, your local development environment needs the developer licensefile with permissions to your AppSource app object IDs" + $default = "" + } + else { + $description = "When developing PTEs, you can optionally specify a developer licensefile with permissions to object IDs of your dependant apps" + $default = "none" + } + + $licenseFileUrl = Enter-Value ` + -title "LicenseFileUrl" ` + -description $description ` + -question "Local path or a secure download URL to license file " ` + -default $default + + if ($licenseFileUrl -eq "none") { + $licenseFileUrl = "" + } +} + +CreateDevEnv ` + -kind local ` + -caller local ` + -containerName $containerName ` + -baseFolder $baseFolder ` + -auth $auth ` + -credential $credential ` + -LicenseFileUrl $licenseFileUrl ` + -InsiderSasToken $insiderSasToken +} +catch { + Write-Host -ForegroundColor Red "Error: $($_.Exception.Message)`nStacktrace: $($_.scriptStackTrace)" +} +finally { + if ($fromVSCode) { + Read-Host "Press ENTER to close this window" + } +}