I have MS SQL Server 2019 where encrypted connections have been enabled. A certificate has been issued and installed on the server. In addition, I have also enabled Force Protocol Encryption in SQL Server Configuration Manager for 32-bit and 64-bit clients.
All clients can connect without a single issue.
Problems arise when I try to run a Maintenance Plan with Back Up Database Task.
It errors out with:
Could not load package "Maintenance Plans\MaintenancePlan" because of error 0xC0014062.
Description: The LoadFromSQLServer method has encountered OLE DB error code 0x80004005 (Client unable to establish connection).
The SQL statement that was issued has failed.
Source: Started: 0.00.00 Finished: 0.00.00 Elapsed: 0.109 seconds.
The package could not be loaded. The step failed.
In addition, Event Viewer has following error in it.
The certificate received from the remote server does not contain the expected name. It is therefore not possible to determine whether we are connecting to the correct server. The server name we were expecting is . The TLS connection request has failed. The attached data contains the server certificate.
As soon as I disable the aforementioned Force Protocol Encryption in SQL Server Configuration Manager for clients, the Maintenance Plan works. Or if I enable Trust Server Certificate in the same place, the Maintenance Plan works.
I am quite baffled by this issue, because all normal client connections do work even with Force Protocol Encryption enabled and Trust Server Certificate disabled.
Even SQL Server Management Studio works when run locally on the SQL Server, regardless of whether I have enabled Encrypt connection under Connection Properties.
Apparently this is not a common issue, or configuration, because Google search results found no similar cases to mine.
So my my question is, why is it only the Maintenance Plans that are unable to connect and how do I solve the problem without disabling Force Protocol Encryption, or enabling Trust Server Certificate?