-1

I have a web app that is hosted on one account, and another account which has a VM. I want to be able to run the script on that VM by clicking on a button on the web app and return its output. I'm confused as to whether or not I'll need Vnet-Vnet gateway connection or how to approach this problem?

emily
  • 1
  • 1

2 Answers2

1

There can be multiple ways to approach the problem depending upon what kind of environment the webapp is hosted on.

Approach One:

If you are willing to move the webapp to a docker container then we can install infrastructure orchestration tool like ansible in the container which will be the host machine. So now, when you click the button on the webapp you can run a process in the container .i.e. ansible playbook and run the script on the remote machine.

Approach Two:

On the virtual machine we write a webapp which can provide an api or socket connection to trigger the script. From the webapp you hit that api.

Networking Aspect:

Whether you write follow approach one or two you need to have a mechanism to communicate between the two services. If both machines have a public IP then you can withlist the IP:PORT you are using for communication. But if that's not the case and both are in two private vnet's then you have a couple of options building a VPN gateway, Vnet-Vnet peering or Using an Express Route.

  • Thank you. I will research the options. I also forgot to include -- if I am running the script on my VM and it writes to a file, how would I return that file to the web app so that a user on the web app can retrieve the file and download it? – emily Mar 14 '21 at 00:30
0

You can also explore the option of triggering a workflow within Azure Logic apps from your web app which in turn executes an Azure dev ops pipeline. The integration will be much easy to do as per above as all the components will be available to you natively.

A Modgil
  • 260
  • 1
  • 7