I had a scenario where I was using a single name SSL certificate which was setup for mail.domain.test. I needed to get autodiscover to work for this domain name. The DNS host was Godaddy.
I configured an SRV record as follows:
The target pointed to the certificate name. EG: mail.domain.test. This allowed the https://testconnectivity.microsoft.com test to go through.
References:
https://au.godaddy.com/help/outlook-windows-manually-add-autodiscover-srv-record-20066