Hello,
When you login as hostname, a server certificate will be verified (a default certificate), you can check if there's any issue on your server side on your certificate.
You can open your local certificate by command "certlm.msc" , you can easily find the remote desktop certificate here. Confirm if you have a self-signed from your CA server and anything related.
You can also check in your event log if there is any issue. To enable log, go to
Event Viewer - > Microsoft -> Windows -> CAPI2 , and try to login again if there is any error on your certificate.
If the Answer is helpful, please click "Accept Answer" and upvote it.