Using a Microsoft Azure DevOps Hosted Agent and a self-signed certificate is… pretty brave. Using self-signed certificates for internet-facing services is typically a bad idea
If using self-signed certificates is a requirement, it might be better for you to manage your own build agent where you have full control over things like installing certificates that the system recognizes