Submitting an HPC job from on-premise

Nowadays, there are lots of links available on the net that tells us of how to submit a job to an Azure HPC Scheduler. I also explored the most of them, and found out that almost all are talking about the job submission from the cloud premise (Front or Head node). But, nowhere did they mention about submitting a job from the outside of the cloud vicinity. I came across this issue while working on one of my assignments.

After hitting my head, I finally found out a way to do this. When we are talking about an interaction between the cloud and the on-premise, then the first thing that comes to our mind is the network. Here, definitely, TCP won’t work. The transport schemes available in the Azure HPC framework are few. After exploring them, I found one WebAPI and wow, that suited my requirement. I only used the WebAPI as the transport scheme, by modifying the name of the headnode to complete the host name (i.e. <headNodeName>.cloudapp.net), and I got my issue resolved. The sample code is as:
 

Note:
If everything (service name, head node, etc...) has been configured properly and even then you are getting an exception such as, ‘Fail to get the cluster name’. Then just redeploy the HPC scheduler package and try it again. I know, this is painful, but this is the only solution, I came across it. And believe me, only this clicked for me.

Hope it will be helpful for those who get stuck with the similar kind of issues.