Closed GreatScott000 closed 3 years ago
Okay so I misread the code but still don't understand. This implies a 100 second timeout, correct? My file is not that big and downloads quickly in Edge. Why would I fall into the Catch statement?
[int] $timeout = 100
(New-Object TimeoutWebClient -ArgumentList (1000*$timeout)).DownloadFile($sourceUrl, $destinationFile)
Ignore this a bit. Something else going on.
My assumption is that the URL in installapps is wrong. The forbidden is not coming from Download-File - it comes from the remote server: "The remote server returned an error: (403) Forbidden." likely the auth info is wrong
Yeah, can't find download it with (New-Object System.Net.WebClient).DownloadFile($uri, $OutFile) but can with the uri in edge. How does that make sense?
I don't know. Download-file is used to download artifacts (also insider artifacts) so it works for secure urls as well. My assumption is that it is some encoding of some kind. If you get stuck, you can email me a url which doesn't work and I can have a look.
Okay, I think I have found the problem.
Run-AlValidation `
-licenseFile $licenseFile `
-apps $apps ` #Type is Object[]
-installApps $installApps ` #Type is string
-previousApps $previousApps `
-countries 'gb' `
-affixes $affixes `
-skipVerification
in Run-AlValidation at Line 213
if ($installApps -is [String]) { $installApps = @($installApps.Split(',').Trim() | Where-Object { $_ }) }
#$installApps is now an Object[]
in Run-AlValidation at Line 220
$installApps = $installApps | % { GetFilePath $_ }
#$installApps is now a string
in Run-AlValidation at Line 331
@(CopyAppFilesToFolder -appFiles @($installApps+$apps) -folder $tmpAppsFolder)...
#@($installApps+$apps) try to combine string and object[] and returns an object[] of length 1 rather than an object[] of length 6 (in my case)
#that looks like installAppUrlApp1path App2path App3path App4path App5Path note there is no space between the installAppUrl and App1Path
That then gets passed to CopyAppFilesToFolder and then ultimately to Download-File with 'installAppUrlApp1path App2path App3path App4path App5Path' as the sourceUrl and then I get the 403 error.
Even if I pass $installApps as an object[] e.g. @($installApps)
Run-AlValidation at line 220 converts it back to a string.
One way to fix this is after line 220 to the conversion of installApps to an array again like at line 213
if ($installApps -is [String]) { $installApps = @($installApps.Split(',').Trim() | Where-Object { $_ }) }
However I am sure there is a more elegant way
FYI, this is BCContainerHelper 2.12
I will investigate
Yes I tried that with the variable not the directly with the url, if that would make any difference.
If you need it I can provide my script/apps/etc.
I will let you know if I cannot repro. Thanks for the detailed investigations.
I tried to add this parameter:
-installApps @( "https://businesscentralapps.blob.core.windows.net/bingmaps/latest/apps.zip?sv=2020-04-08&st=2021-05-26T06%3A11%3A30Z&se=2021-05-27T06%3A11%3A30Z&sr=b&sp=r&sig=%2FvjrB0V0yFF4aes3leY7CZmEuJCPgD6lovje6j6AP3g%3D" )
that works fine.
Could you email me the URL you use?
Hi Freddy, I sent an email with the url. It has the issue number in the subject.
Shipped in 2.0.13
PLEASE DO NOT INCLUDE ANY PASSWORDS OR TOKENS IN YOUR ISSUE!!!
Describe the issue Trying to use Run-ALValidation. I have been following your CICD workshop and have my library app stored in blob storage. I need that for my for validation so I put the blob SAS url in as "installApps" parameter. I get a download error because my url is not in the list accepted by Download-File.
Is there a reason why Download-File is exclusive?
Is there a trick I am missing?
Scripts used to create container and cause the issue
Full output of scripts
Screenshots If applicable, add screenshots to help explain your problem.
Additional context