question

JeffreyBane-8793 avatar image
0 Votes"
JeffreyBane-8793 asked JamesHamil-MSFT edited

Connection reset error trying to request Azure Access Token

Hello,

Using the Azure library in Java to try to obtain a token with the following code:

     ConfidentialClientApplication app = ConfidentialClientApplication.builder(
             config.getClientId(),
             ClientCredentialFactory.createFromCertificate(key, cert))
             .authority(config.getAuthority())
             .build();

     ClientCredentialParameters clientCredentialParam = ClientCredentialParameters.builder(Collections.singleton(config.getScope()))
             .build();

     CompletableFuture<IAuthenticationResult> future = app.acquireToken(clientCredentialParam);
     return future.get();


This works just fine on my machine but once my organization deploys it to our development server we get the following error:

 "eventMessage" : "com.microsoft.aad.msal4j.MsalClientException: javax.net.ssl.SSLException: java.net.SocketException: Connection reset",
 "eventDetails" : "java.net.SocketException: Connection reset

It is behind a firewall and they've opened up the following URLs:

https://login.microsoftonline.com/
https://graph.microsoft.com/

What else needs to be done to make this work behind a firewall?

Thanks.

azure-ad-connectazure-ad-authenticationazure-ad-graphazure-ad-app-development
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @JeffreyBane-8793 , have you looked into Web Application Firewall documentation? You can view which requests are blocked by the firewall and work from there. Please let me know if need more assistance!

Best,
James


0 Votes 0 ·

That's not really what I'm asking, don't you have a document for configuring a firewall for Azure access? Essentially a document of what needs to be whitelisted for Azure access to function behind a firewall. For example, if I want to run SQL Server behind a firewall, I can refer to the documentation to see what ports need to be open:

https://docs.microsoft.com/en-us/sql/sql-server/install/configure-the-windows-firewall-to-allow-sql-server-access?view=sql-server-ver15

Where is a similar document for Azure access?

0 Votes 0 ·

1 Answer

JamesHamil-MSFT avatar image
0 Votes"
JamesHamil-MSFT answered JamesHamil-MSFT edited

Hi @JeffreyBane-8793 , sorry for the delay in response. I believe that this document can help you. Please let me know if you need anything else.

If this answer helped you please mark it as "Verified" so other users may reference it.

Best,
James


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.