microsoft / AL-Go

The plug-and-play DevOps solution for Business Central app development on GitHub
MIT License
293 stars 125 forks source link

LocalDevEnv.ps1 can't Dowload the file license file #345

Closed jonaswre closed 1 year ago

jonaswre commented 1 year ago

The localDevEnv.ps1 script can't download the license file from a secure url.

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.

Reading ..\.github\AL-Go-Settings.json
Reading .AL-Go\settings.json
Checking System Requirements

Container name
--------------
Please enter the name of the container to create (default bcserver)
bcserver selected

Authentication mechanism for container
--------------------------------------
a Windows Authentication
b Username/Password authentication

Select authentication mechanism for container (default b)
Username/Password authentication selected

PowerShell credential request
Please enter username and password for your container
Password for user admin: *****

LicenseFileUrl
--------------
When developing AppSource Apps, your local development environment needs the developer licensefile with permissions to your AppSource app object IDs

Local path or a secure download URL to license file  https://<url>/bc-current/<my>.bclicense?sp=r&st=2023-01-10t14:11:51z&se=2025-01-10t22:11:51z&spr=https&sv=2021-06-08&sr=b&sig=<sig>
https://<url>/bc-current/<my>.bclicense?sp=r&st=2023-01-10t14:11:51z&se=2025-01-10t22:11:51z&spr=https&sv=2021-06-08&sr=b&sig=<sig> selected

Downloading BcContainerHelper developer version from https://github.com/freddydk/navcontainerhelper/archive/master.zip
Using 7zip
BcContainerHelper version 4.0.9-dev
BC.HelperFunctions emits usage statistics telemetry to Microsoft
WARNING: BcContainerHelper running on PowerShell7 is work-in-progress. Please report any issues on https://github.com/microsoft/navcontainerhelper/issues.
Reading ..\.github\AL-Go-Settings.json
Reading .AL-Go\settings.json
Checking type
Checking appFolders and testFolders
Application Dependency 21.0.0.0
Checking artifact setting
Downloading artifacts from https://bcartifacts.azureedge.net/sandbox/21.3.51409.51871/de
Updating app- and test Dependencies
Analyzing Test App Dependencies
Checking project dependencies
Checking appDependencyProbingPaths
WARNING: No performance test apps found in bcptTestFolders in .AL-Go\settings.json
WARNING: No test apps found in testFolders in .AL-Go\settings.json
  _____                               _
 |  __ \                             | |
 | |__) |_ _ _ __ __ _ _ __ ___   ___| |_ ___ _ __ ___
 |  ___/ _` | '__/ _` | '_ ` _ \ / _ \ __/ _ \ '__/ __|
 | |  | (_| | | | (_| | | | | | |  __/ |_  __/ |  \__ \
 |_|   \__,_|_|  \__,_|_| |_| |_|\___|\__\___|_|  |___/

Pipeline name                   localDevEnv
Container name                  bcserver
Image name
ArtifactUrl                     https://bcartifacts.azureedge.net/sandbox/21.3.51409.51871/de
SasToken                        Not Specified
BcAuthContext                   Not Specified
Environment
ReUseContainer                  False
KeepContainer                   True
Auth                            UserPassword
Credential                      Specified
CompanyName
MemoryLimit                     8G
FailOn                          error
TreatTestFailuresAsWarnings     False
Enable Task Scheduler           False
Assign Premium Plan             False
Install Test Runner             False
Install Test Framework          False
Install Test Libraries          False
Install Perf. Toolkit           False
InstallOnlyReferencedApps       True
generateDependencyArtifact      False
CopySymbolsFromContainer        False
enableCodeCop                   False
enableAppSourceCop              True
enableUICop                     False
enablePerTenantExtensionCop     False
doNotPerformUpgrade             False
doNotPublishApps                False
uninstallRemovedApps            False
escapeFromCops                  False
doNotBuildTests                 False
doNotRunTests                   True
doNotRunBcptTests               True
useDefaultAppSourceRuleSet      False
rulesetFile
azureDevOps                     False
gitLab                          False
gitHubActions                   False
License file                    Specified
CodeSignCertPfxFile             Not specified
CodeSignCertPfxPassword         Not specified
CodeSignCertIsSelfSigned        False
KeyVaultCertPfxFile             Not specified
KeyVaultCertPfxPassword         Not specified
KeyVaultClientId
BuildOutputFile
ContainerEventLogFile
TestResultsFile                
BcptTestResultsFile            
TestResultsFormat               JUnit
AdditionalCountries
PackagesFolder
OutputFolder
BuildArtifactFolder
CreateRuntimePackages           False
AppVersion
AppBuild                        0
AppRevision                     0
Mandatory Affixes               
Supported Countries
ObsoleteTagMinAllowedMajorMinor
Install Apps
- None
Install Test Apps
- None
Previous Apps
- None
Application folders
- app
Test application folders
- None
BCPT Test application folders
- None
Custom CodeCops
- None

  _____       _ _ _                                          _        _
 |  __ \     | | (_)                                        (_)      (_)
 | |__) |   _| | |_ _ __   __ _    __ _  ___ _ __   ___ _ __ _  ___   _ _ __ ___   __ _  __ _  ___
 |  ___/ | | | | | | '_ \ / _` |  / _` |/ _ \ '_ \ / _ \ '__| |/ __| | | '_ ` _ \ / _` |/ _` |/ _ \
 | |   | |_| | | | | | | | (_| | | (_| |  __/ | | |  __/ |  | | (__  | | | | | | | (_| | (_| |  __/
 |_|    \__,_|_|_|_|_| |_|\__, |  \__, |\___|_| |_|\___|_|  |_|\___| |_|_| |_| |_|\__,_|\__, |\___|
                           __/ |   __/ |                                                 __/ |
                          |___/   |___/                                                 |___/

Pulling mcr.microsoft.com/businesscentral:10.0.20348.1366-dev

Pulling generic image took 3 seconds

   _____                _   _                               _        _
  / ____|              | | (_)                             | |      (_)
 | |     _ __ ___  __ _| |_ _ _ __   __ _    ___ ___  _ __ | |_ __ _ _ _ __   ___ _ __
 | |    | '__/ _ \/ _` | __| | '_ \ / _` |  / __/ _ \| '_ \| __/ _` | | '_ \ / _ \ '__|
 | |____| | |  __/ (_| | |_| | | | | (_| | | (__ (_) | | | | |_ (_| | | | | |  __/ |
  \_____|_|  \___|\__,_|\__|_|_| |_|\__, |  \___\___/|_| |_|\__\__,_|_|_| |_|\___|_|
                                     __/ |
                                    |___/

BcContainerHelper is version 4.0.9-dev
BcContainerHelper is not running as administrator
UsePsSession is False
Host is Microsoft Windows 11 Enterprise - 22H2
Docker Client Version is 20.10.21
Docker Server Version is 20.10.21
Removing Desktop shortcuts
Removing C:\ProgramData\BcContainerHelper\Extensions\bcserver
Fetching all docker images
Fetching all docker volumes
Using image mcr.microsoft.com/businesscentral:10.0.20348.1366-dev
Creating Container bcserver
Style: sandbox
Multitenant: Yes
Version: 21.3.51409.51871
Platform: 21.0.51393.51624
Generic Tag: 1.0.2.13-dev
Container OS Version: 10.0.20348.1366 (ltsc2022)
Host OS Version: 10.0.22621.963 (22H2)
Using process isolation
Using locale de-DE
Disabling the standard eventlog dump to container log every 2 seconds (use -dumpEventLog to enable)
Using license file https://<url>/bc-current/<my>.bclicense
Downloading C:\ProgramData\BcContainerHelper\Extensions\bcserver\my\license.bclicense
Using HttpClient
Error downloading..., retrying in 2 seconds...
Using HttpClient
New-BcContainer Telemetry Correlation Id: 4dd24903-7ea6-45a1-b0c0-3db0e5ce893d
Run-AlPipeline Telemetry Correlation Id: cad516a2-1099-4f0e-bfd0-80ecd29b96b4
Removing BcContainerHelper
Error: Exception calling "GetResult" with "0" argument(s): "Response status code does not indicate success: 403 (Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.)."
Stacktrace: at Download-File, C:\Users\User\AppData\Local\Temp\8d0e3318-9eb5-490a-ba5b-9395297c0d1d\navcontainerhelper-master\Common\Download-File.ps1: line 84
at New-BcContainer, C:\Users\User\AppData\Local\Temp\8d0e3318-9eb5-490a-ba5b-9395297c0d1d\navcontainerhelper-master\ContainerHandling\New-NavContainer.ps1: line 1484
at <ScriptBlock>, C:\Users\User\AppData\Local\Temp\8d0e3318-9eb5-490a-ba5b-9395297c0d1d\navcontainerhelper-master\AppHandling\Run-AlPipeline.ps1: line 647
at <ScriptBlock>, C:\Users\User\AppData\Local\Temp\8d0e3318-9eb5-490a-ba5b-9395297c0d1d\navcontainerhelper-master\AppHandling\Run-AlPipeline.ps1: line 840
at <ScriptBlock>, C:\Users\User\AppData\Local\Temp\8d0e3318-9eb5-490a-ba5b-9395297c0d1d\navcontainerhelper-master\AppHandling\Run-AlPipeline.ps1: line 783
at <ScriptBlock>, C:\Users\User\AppData\Local\Temp\8d0e3318-9eb5-490a-ba5b-9395297c0d1d\navcontainerhelper-master\AppHandling\Run-AlPipeline.ps1: line 766
at Run-AlPipeline, C:\Users\User\AppData\Local\Temp\8d0e3318-9eb5-490a-ba5b-9395297c0d1d\navcontainerhelper-master\AppHandling\Run-AlPipeline.ps1: line 731
at CreateDevEnv, C:\Users\User\AppData\Local\Temp\tmp2C60.tmp.ps1: line 1589
at <ScriptBlock>, C:\Users\User\Projects\Products\Product\Attributes\.AL-Go\localDevEnv.ps1: line 150
at <ScriptBlock>, <No file>: line 1

The URL is valid. I've directly copied it from the Blobstorage dashboard.

A local path didn't work either. If tried double and single \ in the path.

BcContainerHelper is version 4.0.9-dev
BcContainerHelper is not running as administrator
UsePsSession is False
Host is Microsoft Windows 11 Enterprise - 22H2
Docker Client Version is 20.10.21
Docker Server Version is 20.10.21
Removing Desktop shortcuts
Removing C:\ProgramData\BcContainerHelper\Extensions\bcserver
Fetching all docker images
Fetching all docker volumes
Using image mcr.microsoft.com/businesscentral:10.0.20348.1366-dev
Creating Container bcserver
Style: sandbox
Multitenant: Yes
Version: 21.3.51409.51871
Platform: 21.0.51393.51624
Generic Tag: 1.0.2.13-dev
Container OS Version: 10.0.20348.1366 (ltsc2022)
Host OS Version: 10.0.22621.963 (22H2)
Using process isolation
Using locale de-DE
Disabling the standard eventlog dump to container log every 2 seconds (use -dumpEventLog to enable)
Using license file "c:\\temp\\bc21.bclicense"
New-BcContainer Telemetry Correlation Id: fb2f7356-e42d-4fb1-b8d8-356394892d66
Run-AlPipeline Telemetry Correlation Id: fafb1061-ab05-42da-b208-1d680f447038
Removing BcContainerHelper
Error: Exception calling "GetExtension" with "1" argument(s): "Illegal characters in path."
Stacktrace: at New-BcContainer, C:\Users\User\AppData\Local\Temp\87c67a4d-fae6-4bc7-8983-51e745d1db10\navcontainerhelper-master\ContainerHandling\New-NavContainer.ps1: line 1492
at <ScriptBlock>, C:\Users\User\AppData\Local\Temp\87c67a4d-fae6-4bc7-8983-51e745d1db10\navcontainerhelper-master\AppHandling\Run-AlPipeline.ps1: line 647
at <ScriptBlock>, C:\Users\User\AppData\Local\Temp\87c67a4d-fae6-4bc7-8983-51e745d1db10\navcontainerhelper-master\AppHandling\Run-AlPipeline.ps1: line 840
at <ScriptBlock>, C:\Users\User\AppData\Local\Temp\87c67a4d-fae6-4bc7-8983-51e745d1db10\navcontainerhelper-master\AppHandling\Run-AlPipeline.ps1: line 783
at <ScriptBlock>, C:\Users\User\AppData\Local\Temp\87c67a4d-fae6-4bc7-8983-51e745d1db10\navcontainerhelper-master\AppHandling\Run-AlPipeline.ps1: line 766
at Run-AlPipeline, C:\Users\User\AppData\Local\Temp\87c67a4d-fae6-4bc7-8983-51e745d1db10\navcontainerhelper-master\AppHandling\Run-AlPipeline.ps1: line 731
at CreateDevEnv, C:\Users\User\AppData\Local\Temp\tmp7095.tmp.ps1: line 1589
at <ScriptBlock>, C:\Users\User\Projects\Org\Products\Product\.AL-Go\localDevEnv.ps1: line 150
at <ScriptBlock>, <No file>: line 1
freddydk commented 1 year ago

This is a containerhelper problem - will have a look.

freddydk commented 1 year ago

Was too quick - the problem is in LocalDevEnv.ps1

This line:

    $licenseFileUrl = Enter-Value `
        -title "LicenseFileUrl" `
        -description $description `
        -question "Local path or a secure download URL to license file " `
        -default $default

Needs to have -doNotConvertToLower added.

jonaswre commented 1 year ago

Thanks Freddy

freddydk commented 1 year ago

I'm the one saying thanks:-)