<h2>Discovery is failing with "PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException" error.</h2><br/><div style="overflow-x:auto"><article><div ><h3 >Issue </h3><section><p style="padding-left: 40px;"><strong>Discovery is failing with below error:</strong></p> <p style="padding-left: 40px;">Exception occurred while executing operation Cloud REST - add response to context. Custom operation Failed to run script due to the following error: JAVASCRIPT_CODE_FAILURE: Exception occurred when making http call to the provider. Cause: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target (script_include:AzureApiCommand; line 117)</p></section></div><div ><h3 >Cause</h3><section><p style="padding-left: 40px;">The SSL handshake with target API url is failing because of no valid certificate is available in mid server. </p></section></div><div ><h3 >Resolution</h3><section><ol style="list-style-position: inside;"><li>Collect the certificates from your internal team.</li><li>Alternatively you can also collect the certificates by browsing your URL from Internet Explorer.</li><li>Once you have the certificates, follow the documentation below to add SSL certificates to the MID Server installation.<br /><a href="https://docs.servicenow.com/csh?topicname=add-ssl-certificates.html&version=latest">https://docs.servicenow.com/csh?topicname=add-ssl-certificates.html&version=latest</a></li><li>Once the certificates are installed, you can list the installed certificates using below keytool command. Search for the alias name of the certificate that is just installed. <ul style="list-style-position: inside;"><li><MID Installation>/jre/bin/keytool -list -v -keystore <MID Installation>jre/lib/security/cacerts</li></ul> </li><li>If a prompt for a password is show, enter if you have any custom password or use the default password i.e "changeit"</li></ol></section></div></article></div>