teamcityautomated-teststeamcity-8.0octopus-deployautomated-deploy

TeamCity Octopus Deploy Create Release cannot read API key


I am using TeamCity for automated testing and now I want to automate my deployments with the Octopus plugin. As of now I can create releases from the octopus server using my TeamCity packages manually but I want to automate it with my builds and make it a lot easier to keep track of my project versions. I have followed the directions from the documentation and the video from: http://docs.octopusdeploy.com/display/OD/TeamCity

I get the following error

Error from Octopus server (HTTP 401): You must be logged in to perform this action. Please provide a valid API key or log in again.

I am creating an API key from my profile and it doesn't matter if the Administrator generates the key or not I do not have access. My Octopus version is 2.5.7.384 and TeamCity Enterprise version 8.1.2

Here is the build log :

Step 1/1: OctopusDeploy (OctopusDeploy: Create release)

[15:53:17][Step 1/1] Octopus Deploy

[15:53:17]Running command:   octo.exe create-release --server http://nameofmyoctopusserver/ --apikey SECRET --project TCtest --enableservicemessages --version 44 --deployto Environment--waitfordeployment

[15:53:17]Creating Octopus Deploy release

[15:53:17]Octopus Deploy Command Line Tool, version 2.1.2.36

[15:53:17]

[15:53:18]Handshaking with Octopus server: http://nameofmyoctopusserver/

[15:53:18]Handshake successful. Octopus version: 2.5.7.384; API version: 3.0.0

[15:53:18]Finding project: TCtest

[15:53:18]Error from Octopus server (HTTP 401): You must be logged in to perform this action. Please provide a valid API key or log in again.

[15:53:18]Exit code: -7

[15:53:18]Octo.exe exit code: -7

[15:53:18][Step 1/1] Unable to create or deploy release. Please check the build log for details on the error.

[15:53:18][Step 1/1] Step OctopusDeploy (OctopusDeploy: Create release) failed

[15:53:18]Publishing internal artifacts

[15:53:18]Build finished

Solution

  • Did you make sure that you copy the full key including the "API-" in front of it? I came across this in the past and found this to be the issue.