title: java.lang.RuntimeException: javax.net.ssl.SSLHandshakeException
body: <p><strong>Azure java SDK</strong> gives ->
  <strong>java.lang.RuntimeException: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target</strong></p>
  
  <pre><code>    ApplicationTokenCredentials credentials = new ApplicationTokenCredentials(options.getClientId(), options.getTenantId(),   options.getClientSecret(), AzureEnvironment.AZURE);
  
      subscriptionIds.forEach((subscriptionId)-&gt;{
          Azure azure = Azure.authenticate(credentials).withSubscription(subscriptionId);
          ResourceGroups resourceGroups = azure.resourceGroups();
          for(ResourceGroup resourceGroup : resourceGroups.list()){
              for(VirtualMachine virtualMachine : azure.virtualMachines().listByGroup(resourceGroup.name())){
                  logger.info(virtualMachine.name());
              }
          }
      });
  </code></pre>
  
  <p>I get this error when <strong>for(ResourceGroup resourceGroup : resourceGroups.list())</strong> is executed.
  Looking on the net, i added the certificate of management.azure.com in keystore, but that also didn't worked.
  Looks like azure establish the connection that's why ResourceGroups are not empty. But don't know why it gives the error later.</p>