- Print
- DarkLight
- PDF
Setting up local HTTP Trigger in Logic Apps Standard
- Print
- DarkLight
- PDF
Logic Apps Standard introduces a new way to build integrations by providing people the ability to use Visual Studio Code. Traditionally, when you use the Azure Portal to build logic apps and include an HTTP trigger, an endpoint in the cloud is automatically provisioned for you. You can freely call this cloud endpoint when using the URL and SAS key. However, when trying to locally debug and test your integration from a remote client, we need a tool that will help route an HTTP request to a local network session.
Note: Depending upon your local firewall configuration, the use of ngrok may not be required if want to make local calls on your machine using a localhost URL. However, if you want to be able to use other clients to make calls to your machine, the use of ngrok will be required.
To help with this requirement, we can use ngrok. We can sign up for ngrok here. Once we have created an account, we need to download a software agent from the Setup and Installation link.
Once we have downloaded and unzipped the file, we need to associate our Authtoken with our machine. We can grab our Authtoken from the left navigation menu.
Once we have our Authtoken, we need to use it in a command line argument to associate with our configuration file.
./ngrok authtoken < Your AuthToken >
Next, we can run another command that will start our relay service from having a public endpoint that can route to our local machine. This command is ngrok http 7071
The result is we will now have a publicly routable URL that we can use to call our process. Make a note of these URLs (http and https) as we will need them later on.
We can now design our logic app that includes an HTTP trigger and HTTP response.
After starting Azurite, we can save and run this logic app. In our Terminal window we will see that our service is now running. This is a good sign, but there are some additional query parameters that we need that aren’t visible in this view including our SAS token for security.
To get these additional query parameters, first refresh your explorer window by clicking on the refresh icon beside your project name.
Find your workflow.json file, right mouse click on it and then select Overview.
When you do this, a new window will open and we can retrieve our Callback URL. Copy this value.
Open up PostMan, and create a new request that will make a POST call. Paste this URL into the URL field. Then replace the localhost value with your ngrok URL that we previously created.
Note: As discussed earlier, you may also use the local URL provided you don’t have a machine-based firewall blocking calls.
Conclusion
Logic Apps Standard introduces some new development experience when building integrations. In this post we discussed how we can locally trigger a logic app that has an HTTP trigger.