Problems connecting to Octopus server when using "register-with" from the tentacle machine

I’ve been trying to use the “tentacle.exe register-with” via powershell in order to automate reconfiguring our test systems when they get refreshed from our production instances. However, whenever I try I get “401 unauthorized” exception. I’ve tried both with and without the user/pass parameters to no avail. What id exactly do I need to be using in order to do this? Is it an account that’s been added as part of the OctopusAdmin group? Or can it be any user? Or none of the above?

Here’s a sample of my powershell command, with the apikey being saved during a “new-certificate”:

& $TentacleExePath “register-with” --server=http://serverurl --environment=‘Test’ --apikey=$apikey --user=testuser --pass=testpass

And here’s the actual exception:

System.Net.WebException: The remote server returned an error: (401) Unauthorized.
at System.Net.HttpWebRequest.GetResponse()
at Octopus.Client.OctopusSession.Get[TResource](String path) in c:\w\e6923628be6eaf72\source\Octopus.Client\OctopusSession.cs:line 52
at Octopus.Client.OctopusSession.EstablishSession() in c:\w\e6923628be6eaf72\source\Octopus.Client\OctopusSession.cs:line 113
at System.Lazy1.CreateValue() at System.Lazy1.LazyInitValue()
at Octopus.Client.OctopusSession.get_RootDocument() in c:\w\e6923628be6eaf72\source\Octopus.Client\OctopusSession.cs:line 33
at Octopus.Client.Operations.RegisterMachineOperation.Execute(OctopusConnection connection) in c:\w\e6923628be6eaf72\source\Octopus.Client\Operations\RegisterMachineOperation.cs:line
at Octopus.Tentacle.Commands.RegisterMachineCommand.Execute() in c:\w\e6923628be6eaf72\source\Octopus.Tentacle\Commands\RegisterMachineCommand.cs:line 78
at Octopus.Shared.Startup.CommandProcessor.Process(String[] args) in c:\w\e6923628be6eaf72\source\Octopus.Shared\Startup\CommandProcessor.cs:line 40

Hi Chad,

You should pass your API key (from your Octopus user). You should only use --user and --pass if you are using Windows authentication to access your Octopus server, and in this case, it should be your Windows/AD username/password.