This post is part of an Azure Function Proxies blog series:
- Part 1: Represent heterogenous service operations into a single API
- Part 2: Easily enable hybrid integration
- Part 3: Secure your API
- Part 4: A very light-weight API management
Connecting cloud services to on premises API’s can be quite challenging. Depending on your setup, there are multiple options available. The most enterprise grade options reside on the network level: ExpressRoute and Site-to-Site VPN. Another option is leveraging Azure App Service Hybrid Connections, which gives you a very simple way to connect to on premise resources on the TCP level, in a firewall-friendly and high available manner. This blog will demonstrate how you can consume an on premises API via Azure Function Proxies, without any coding at all.
Instructions
Following these instructions to setup hybrid connectivity through hybrid connections:
- In order to take advantage of hybrid connections, you must ensure that you create the Azure Function Proxy within an Azure App Service Hosting Plan.
- Navigate to Platform features and click on Networking
Consumption plans do not support networking features, as they are instantiated at runtime on shared compute.
- Click on Configure your hybrid connection endpoints
- Download the Hybrid Connection Manager
- Start the installation with accepting the License Agreement.
- The installation doesn’t take long.
- Click Finish to complete the installation.
- Open the Hybrid Connection Manager UI desktop app.
- At this moment, you should not see any hybrid connection. Ignore the mylaptop connection in the screen capture below, as this is still a legacy BizTalk hybrid connection.
- Back in the Azure Function Networking blade, click Add hybrid connection.
- Choose Create new hybrid connection.
- Give the connection a name, provide the endpoint host name and port. As Hybrid Connections leverages ServiceBus relay technology underneath, you need to provide a ServiceBus namespace.
- Choose in the local Hybrid Connection Manager to Configure another Hybrid Connection.
- Select the previously created hybrid connection and click Save.
- If all goes well, you should see the Connected status for the hybrid connection.
- The Azure Portal should also display a Connected status.
- You can configure now the Azure Function proxy with an external / public URL to point to the local backend URL, which is now available through the Hybrid Connection Manager.
- You can now access your local API from the external world! Be aware that there is currently no security measure applicable. This will be covered in the next part of this blog post series.
High Availability
In case you need high availability, you can install on another server a second Hybrid Connection Manager that connects to the same hybrid connection. The documentation states the following:
Each HCM can support multiple hybrid connections. Also, any given hybrid connection can be supported by multiple HCMs. The default behaviour is to round robin traffic across the configured HCMs for any given endpoint. If you want high availability on your hybrid connections from your network, simply instantiate multiple HCMs on separate machines.
Enjoy this easy hybrid connectivity!
Toon