I have been trying to push the nuget packet using Invoke-WebRequest post method but I am getting authentication errors even though I am using right api key. Can you please help me to solve this issue. Here is the cmdlet I have been trying.
May I ask why are you trying to push the package with invoke-webrequest instead of using Nuget.exe? That Powershell cmdlet can be a bit tricky when it comes to uploading files.
You might also wanna check this LinqPad that my friend Teammate Mike wrote to push packages over HTTP, which proved to be more reliable than nuget.exe itself.
we are feeling like nuget.exe taking considerable time to push the packets and trying to implement invoke-webrequest post using inbuilt octopus API’s in the hope of time taking might come down. All other scripts we have implemented are in powershell, so we want to use powershell for this one as well. Is it possible to get powershell script for this operation?
In Octopus 3.3 you’ll also be able to push packages using the following powershell snippet
$url = "http://OctopusServer/api/packages/raw?apiKey=API-OCTOPUSUSERAPIKEY"
$filePath = "C:\PathToFile\AspNetCoreWebApp.1.0.0.zip" #this could also be a .nupkg
$wc = new-object System.Net.WebClient
$wc.UploadFile($url, $filePath)