$user = "UsernameLoadedFromSecureStore"
$pass = "PasswordLoadedFromSecureStore"
$pair = "$($user):$($pass)"
$encodedCreds = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($pair))
$basicAuthValue = "Basic $encodedCreds"
$Headers = @{Authorization = $basicAuthValue}
Invoke-WebRequest -Uri $uri -OutFile $filename -Headers $Headers
Not a blog about plumbing, or Super Mario, but in fact a series of posts about technology, IT and a few other things.
Search This Blog
Tuesday, 10 September 2019
Invoke-WebRequest auth headers
Add auth headers when downloading files. Useful if pulling files directly from an Azure Devops git repo.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment