Skip to content

get-chocolateywebfile user/pass #2477

Answered by TheCakeIsNaOH
t794104 asked this question in Q&A
Discussion options

You must be logged in to vote

I am assuming that Artifactory supports HTTP(s) basic authentication for downloading files?

If so, you can specify an Authorization header with the required credentials, and pass that to Get-ChocolateyWebFile via the Options parameter.

Here is what I have used to download files from a Nexus server. You will need to get the $user and $password into the script. Hardcoding or passing via package parameters should work.

$CredsBase64           = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes("$user:$password"))
$HeaderCreds           = @{ Headers = @{ Authorization = "Basic $CredsBase64" } }

$packageArgs = @{
  packageName   = $env:ChocolateyPackageName
  FileFullPath…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@t794104
Comment options

Answer selected by t794104
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants