How to create a Hybrid Connection from Azure App Service to on premises SQL Server
When you deploy App Services in Azure sometimes it’s necessary to connect to on premises data sources which may a database server or monitoring server (SCOM) or some other application data. Since your App Service is using a predefined netwok it’s important to use Hybrid connections since Hybrid connections allowed the connectivity with the resources in the other networks. It used in App Service, each Hybrid Connection correlates to a single TCP host and port combination. This means that the Hybrid Connection endpoint can be on any operating system and any application, provided you are accessing a TCP listening port.
As per MS the Hybrid connection has the following benefits:
- Apps can access on-premises systems and services securely.
- The feature does not require an internet-accessible endpoint.
- It is quick and easy to set up.
- Each Hybrid Connection matches to a single host:port combination, helpful for security.
- It normally does not require firewall holes. The connections are all outbound over standard web ports.
- Because the feature is network level, it is agnostic to the language used by your app and the technology used by the endpoint.
- It can be used to provide access in multiple networks from a single app.
As you can see in the point number 4 and 5 hybrid connections are secure since they single host and port combination and generally outbound over the standard web ports.
Today I am going to show you how we can create a hybrid connection to a SQL database which is part of a different newtork which is a part of on premises resources.
Fig: Architecture of Hybrid Connection.
As you can see that our SQL server where the App services wants to connect is located in on premises network.
First we need to go to App service and than need to click on the Network tab in the left hand side.
Once you click on the networking tab you can see the following things:
You need to click on the Hybrid connections
The next step is to add hybrid connection
Here you need to give details, Hybrid connection name can be anything you would like to call your hybrid connection, endpoint host is the FQDN of the on premises SQL server name, 1433 is the SQL listening port. Also you need to select the service bus namespace.
Once you submit it will take some time to create.
Once it’s created you can go to properties and see the details.
The last and final step is to view the connection which is just created.
Next, download the Connection Manager using Download Connection Manager. It is basically a download with pre-configured Azure subscription details which, when need to be installed in the on-premises SQL box, acts as a listener to Azure Web App requests.
Once all the hybrid connections are connected you can see below.
That’s all for today, I hope you will like this post on hybrid connection. Since its introduction hybrid connection is very popular among web developers and widely used by them.