Getting MongoSocketOpenException while using bastion port

I am using below Mongo URI in my application. The application is being deployed on the Azure environment. The operation team has whitelisted ports for each server. Below are the bastion ports configured which are overridden with the actual port (25001). After deploying the application on Kubernetes we are getting MongoSocketOpenException
Bastion Port configured:
blph1024.bhdc.att.com → 20366 → Secondary
blph1025.bhdc.att.com → 20368 → Primary
blph1026.bhdc.att.com → 20369 → Secondary
URI → mongodb://<username>:<pwd>@blph1024.bhdc.att.com:25001,blph1025.bhdc.att.com:25001,blph1026.bhdc.att.com:25001/CR?authMechanism=SCRAM-SHA-1&amp;replicaSet=tdataRS&amp;connectTimeoutMS=60000&amp;minPoolSize=0&amp;maxPoolSize=10&amp;maxIdleTimeMS=900000

Logs

{"logType":"DEBUG","logLevel":"INFO","logTimestamp":"2023-07-05T15:48:35.539Z","logger":"org.mongodb.driver.cluster","label":"Exception in monitor thread while connecting to server blph1025.bhdc.att.com:25001","runtime":{"hostName":"N/A","ip":"N/A","instance":"N/A","clusterName":"N/A","namespace":"unknown","image":"unknown","environment":"PROD","version":"1.0.6","routeOffer":"AE2S01-SB"},"application":{"deploymentUnitName":"unknown","motsApplicationAcronym":"unknown"},"exception":{"exceptionDetails":"Exception receiving message","stackTrace":"com.mongodb.MongoSocketReadException: Exception receiving message\n\tat com.mongodb.internal.connection.InternalStreamConnection.translateReadException(InternalStreamConnection.java:569)\n\tat com.mongodb.internal.connection.InternalStreamConnection.receiveMessage(InternalStreamConnection.java:448)\n\tat com.mongodb.internal.connection.InternalStreamConnection.receiveCommandMessageResponse(InternalStreamConnection.java:299)\n\tat com.mongodb.internal.connection.InternalStreamConnection.sendAndReceive(InternalStreamConnection.java:259)\n\tat com.mongodb.internal.connection.CommandHelper.sendAndReceive(CommandHelper.java:83)\n\tat com.mongodb.internal.connection.CommandHelper.executeCommand(CommandHelper.java:33)\n\tat com.mongodb.internal.connection.InternalStreamConnectionInitializer.initializeConnectionDescription(InternalStreamConnectionInitializer.java:105)\n\tat com.mongodb.internal.connection.InternalStreamConnectionInitializer.initialize(InternalStreamConnectionInitializer.java:62)\n\tat com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:129)\n\tat com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:117)\n\tat java.lang.Thread.run(Thread.java:748)\nCaused by: java.net.SocketException: Connection reset\n\tat java.net.SocketInputStream.read(SocketInputStream.java:210)\n\tat java.net.SocketInputStream.read(SocketInputStream.java:141)\n\tat com.mongodb.internal.connection.SocketStream.read(SocketStream.java:109)\n\tat com.mongodb.internal.connection.InternalStreamConnection.receiveResponseBuffers(InternalStreamConnection.java:580)\n\tat com.mongodb.internal.connection.InternalStreamConnection.receiveMessage(InternalStreamConnection.java:445)\n\t... 9 more\n"}}

Hi @RAKESH_SURYAVANSHI and welcome to MongoDB community forums!!

The error message below

shows that the hosts and other details have been missing from the URI you are trying to connect your application to.
Can you confirm if you are able to connect to the MongoDB server outside the application?

Can you share the required yaml file configuration you have set up to make the connection. These files would help me to reproduce the issue in my local environment.
Finally please help us with the bastion port and the MongoDB version you are on.

Regards
Aasawari