Sunday, 1 January 2017

Resolving “Deployment on this environment was cancelled.”

You might encounter “Deployment on this environment was cancelled.” when you have setup a new build/release agent and try to do a deployment, with on premise TFS. It is a confusing error message and not enough information at all to identify the issue. How to identify where the problem is easier if the agent is on premise. Then you have the ability to look at additional diagnostic logs. Lets look at one example scenario you are getting this error.
01
The following links discussing the issue might be useful.
https://social.msdn.microsoft.com/Forums/vstudio/en-US/9e0b3c33-fe7f-4b28-bb88-005c0a1ec01a/vsts-deployment-on-this-environment-was-cancelled?forum=TFService
http://answers.flyppdevportal.com/MVC/Post/Thread/56e9ec27-d8a6-4543-8811-029e3b0340d0?category=tfservice
When checked in the _diag folder logs, this particular issue revealed it was due to untrusted certificate. 02
System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. ---> System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure.
08:08:58.214252    at System.Net.TlsStream.EndWrite(IAsyncResult asyncResult)
08:08:58.214252    at System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar)
08:08:58.214252    --- End of inner exception stack trace ---
08:08:58.214252    at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
08:08:58.214252    at System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar)
08:08:58.214252    --- End of inner exception stack trace ---
The TFS instance had a SSL configured with a privately generated certificate. To fix the issue had to add the certificate to the Trusted Root Certificates of the agent machine. This enabled the agent to work with the TFS.03

No comments: