This post outline how to:
- Setup the on-premises data gateway on an on-premises machine (I will be using my laptop
Note: You shouldn’t install a gateway on a computer, such a laptop, that may be turned off, asleep, or not connected to the Internet because the gateway can’t run under any of those circumstances. In addition, gateway performance might suffer over a wireless network.)
- Build a Logic App than consumes Azure Service Bus queue messages and sends them as text files, through the On-Premises Data Gateway, to a folder on my local machine.
Setup the On-Premises Data Gateway
- You can install the on-premises data gateway here:
- Installation instructions are:
- Here: https://docs.microsoft.com/en-us/azure/logic-apps/logic-apps-gateway-install
- And the Logic App setup is here: https://docs.microsoft.com/en-us/azure/logic-apps/logic-apps-gateway-install
- Run the installer for the on-premises gateway:
- The gateway runs as a windows service and, as with any other windows service, you can start and stop it in multiple ways. For example, you can open a command prompt with elevated permissions on the machine where the gateway is running, and then run either of these commands:
- To stop the service, run this command:
NET STOP PBIEGWSERVICE:
- To start the service, run this command:
NET START PBIEGWSERVICE:
- To stop the service, run this command:
- Here is the windows service that was installed:
- Note that I changed the windows service to run as a newly setup windows account (Administrator) as this is the only way I could get the logic app to authenticate with my local service:
- You may need to ensure your firewall is open. Run the following in PowerShell in adminsitrator mode:
Test-NetConnection -ComputerName watchdog.servicebus.windows.net -Port 9350
And here is the outcome:
- See this link for other firewall options and whitelisting:
- Log onto Azure with the same account you used to set up the on-premise-gateway and create an on-premises gateway in Azure, connecting it to the one on your machine using the drop down at the bottom of the next picture:
- Here is my newly created on-prem-gateway:
- Now go and create a local windows share. I just opened it up to “everyone” for the purposes of my exercise:
Setup the Logic App
- Create the logic app in Azure:
- I used the peek-lock and complete template to make it easier:
- Note that I have already created a service bus namespace and queue for this demo.
- Now add the file connector in and tell it to use the on-premises-data-gateway:
NOTE: The above gateway name 'MondayOnPremGW' does not match the name of the gateway created at the top of this demo as explained here: I had hours of trouble will getting the above setting to connect. In the end, even though I had un-installed the on-premises-gateway many times and cleaned up the resouces in Azure many times I could still see a list of on-premises-data-gateways in Azure: So, finally, I just selected one that had worked for me a few weeks ago. In theory, you should not have the same issue if you create 1 and then use 1. I suspect there are some sort of remnants from previous installs left locally.
Send some messages to the service bus
- I have some c# code to send a number of messages to the service bus.
- For the purposes of this post I will disable the LogicApp and send 10 messages to the service bus so they are visible:
- And the content of 1 message:
- After enabling the Logic App the messaged in the service bus queue are consumed:
- Here is a sample of 1 successful Logic App run:
- And the resulting files on my local file system:
- And here is the content of a file created from a service:
As mentioned above I had hours of trouble will getting the logic app on-premises file connector to connect to my machine.
In the end, even though I had un-installed the on-premises-gateway many times and cleaned up the resouces in Azure many times I could still see a list of on-premises-data-gateways in Azure. So, finally, I just selected one that had worked for me a few weeks ago.
In theory, you should not have the same issue if you create 1 and then use 1 only.
I suspect there are some sort of remnants from previous installs left locally.
We also saw quite a lot of throttling and have been informed by the Microsoft that less limited model is on the way soon:
The average run time was not too good but this might be due to me being on a wifi network:
Overall it was a easy to work with and setup, apart from the issue mentioned above. I think more work may need to be done on the on-premises-gateway install as it seems to hold onto data between un-installing and re-installing.