Cloud and On-Prem with Azure Relay Hybrid Connection
The purpose of Azure Relay Hybrid Connections is to be able to reach into our on premises application without the need to be poking holes into our firewall and leave our network infrastructure relatively untouched. It eliminates any kind of networking related complexities from our solution, reducing our overheads. The service is designed for TCP only traffic however.
Say if we wanted an app in Azure to send requests (via TCP) into our on-premises application to carry out some on-prem bound work or logic, Azure Relay Hybrid Connections is one good way of achieving this. In this blog we will be taking a look at Hybrid Connection as its own standalone service (rather than a service that lives within App Service).
Setup Hybrid Connection Listener
For our on premises application, we can set up a listener 'on-prem' application to serve up responses to requests. Here is an example that will listen to requests over the hybrid connection to offload those requests to Ollama with the Phi4-mini Small Language Model:
Setup Hybrid Connection Azure Function Caller
With our on premise application listening over the Hybrid Connection in Azure, we are now capable of having client applications in the cloud in Azure to reach back into it. We can achieve it this way by posting the request on the same Hybrid Connection instance, here for example with an Azure Function:
The Azure Function above can be run locally or deployed to Azure and what would happen is that the code 'listening' on the Azure Hybrid Connection (wherever in the world it might be!!) would receive the message and in this case would return a result from a local LLM running on the same compute instance/fabric.