Thanks for getting in touch with Octopus, and sorry that you’re having issues with the community step template.
The error you are seeing is actually hiding the real error. The technical details are that the catch block doesn’t have an inner exception, and cant display it. I can get the error handling fixed up, which should be out in the library later today.
You have two choices in the meantime:
Wait until the changes are live and then update the step template version, and see what the actual error is.
Attempt to take the contents of the PowerShell script, and run it in a PowerShell command line / PowerShell ISE window replacing the values with your own.
In my experience, an error being caught like this would indicate an issue with the credentials being used. Since you’re using Window Integrated, the script will take the credentials as the user running the tentacle for the deployment target with role UAT-Tomcat-server. You’d likely need to check that service account has access to connect to the database CreditIT_Sandbox on server CRITSQL_DEV.
The user you log into Octopus with isnt the same user context with which the deployment steps run under.
They will run under the service account for the deployment target you’re deploying with/to.
So for your example, your deployment process had a target with role of UAT-Tomcat-server. If you go to the deployment targets page and find the target that matches that role and that environment, you then need to check the log on identity (user account) for the windows service of the deployment target (the tentacle).
It will be this user that is trying to execute the SQL step, not your own user account logged into Octopus.
Thank you for your recommendation this looks like a easier path
However I now have new issue, the windows authentication. Its using the server name where I have installed the tentacle on as USERID instead of credentials.
This instructs the connection to take the user context from the process running the script, which in the case of an Octopus tentacle, would be the service account running the Windows Service.
If you don’t wish to use Integrated Security, you can provide a SQL username and password in the connection string. For example;
Where myUsername and myPassword would be replaced with the credentials you want to provide. If you’re using SQL authentication like this, then I’d recommend considering placing the password as a sensitive variable in Octopus so that it’s not shown in logs or in plain text.
Alternatively, if you want to use Windows Authentication, then you’d need to change the service account that the tentacle Windows Service is running as to one which has access to the SQL Server in question.