A customer ask me some time ago, is it possible to call an API which is located On-Prem?
The answer is „yes“ with different ways:
- Publish the API On-Prem
- Use Azure ServiceBus as connection Interface
- Use Azure Hybrid Manager
All the parts aren‘t new, but I can’t use the first one because the API is really old without any authentication.
The second one is a good scenario, but an overhead for that solution.
Finally I check the functionality of the third scenario. The service isn’t new, but I’ve implemented it the first time. In that Blog Post, I will explain step by step how I’ve implementing the solution. I’ll also publish the source code to my GitHub repository, so feel free and download the demos and I‘m really happy of any feedback.
Okay let’s start, first I’ve to implement the cloud solution. I’ve installed an Azure function. IMPORTANT only premium or service plan running on Windows is supported at the moment.
Great, everything was deployed now and it looks like:
Okay, go to the Azure Function and select “Platform features”:
In the Network section you find the feature “Hybrid connection”
Click on “Configure your hybrid connection endpoints”.
First we create a new connection, select “Add hybrid connection”
Click on “Create new hybrid connection”
In my use case I create a new connection with the following parameters:
I’ve created a new Servicebus namespace in West Europe with the name:
Cool, the first step is done. In Azure you have now the following services:
Next Step, we install the “connection Manager”. Once more, select the Azure Function and go to “Platform features/Networking/Hybridconnections and select “Download connection manager”
Install the connection manager at one or more server On-Prem. When the installation is finished, open the “Hybrid Connection Manager” and select “Add Hybrid Connection”
Login with an User account, which have permission to the created “service bus namespace” and then select the subscription:
Then select the connection which you’re created previews.
Otherwise, if you don’t have access to the resources, it’s also possible to add the connection string manually, but where can I find the right connection string?
Select the Azure Function, go to “Platform features/Networking/Hybridconnections“. If you don’t see the connection which you have created before, click on “Add hybrid connection”
Select the connection and click on “+ Add selected hybrid connection”
Okay great, now you can see your connection at the main screen. Please select the connection and on the popup window you can see the section “Gateway connection string”
Copy the string and add it to your Connection manager On-Prem. If the connection isn’t established (same like in my case), open the Windows Services and search for the Service “Azure Hybrid Connection Manager Service”. Restart the service and everything should work.
If your connection manager cannot connect, here are some troubleshooting tips:
- TCP access to Azure over port 443.
- TCP access to the Hybrid Connection endpoint.
- The ability to do DNS look-ups on the endpoint host and the Service Bus namespace.
Okay now it’s time to create an API and Azure function. I’ve created those and add the solutions to my GitHub repository.
I also add an Automation script to create the azure resources (without the On-Prem installation”)