Background: If i understand correctly InboundNATPools are used to map a range of external ports each to a specific VM on a VMSS behind a LB.
e.g. {LB_IP:p1,LB_IP:p2, ...} => {VM1:p0,VM2:p0, ...}
Question: How can a VM (i.e. app) discover it's assigned external port?
e.g. in the example above the right port from {p1,p2,..}
A possible approach: i'm considering using an external service which'll listen for connections on a well known port and when a connection is established respond with the source port. I'm reluctant to use it since it means maintaining another service.
Extra details: i'm running on Service Fabric and the protocol for the port is TCP.
Identical unanswered question: Retrieve Azure load balancer NAT port for Azure VM in C# didn't get a valid answer, i hope to resurface the issue.