Deployment job and task fails with the error:
An unknown exception was thrown on server side.
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.
The certificate in the IIS and NS Communication Profiles didn't have the the correct FQDN in the subject or subject alternative name!
The certificate which was bound in the IIS and Communication Profiles had only one DNS name, while the server name (FQDN) and DNS name were different.
Changed the certificate to one that had both the DNS name and FQDN in the Subject and Subject Alternative Name and replaced it in IIS and the NS Communication Profiles.
Getting "Certificate name does not contain the expected fqdn"