2
votes

I have a task to connect on-premise SQL Database from Azure Function through VPN.

For this, it has been created the Hybrid Connection.

I have gateway connection string from hybrid connection like

Endpoint=sb://XXXXXXXX.servicebus.windows.net/;SharedAccessKeyName=defaultListener;SharedAccessKey=YYYYYYYYYYYYYYYYYYYYYYYY;EntityPath=ZZZZZZZZ

What else should I have to get connection string to my on-premise database?

Can you give me an example of how I can get access to DB?

Function have written with C#.

1

1 Answers

1
votes

Various network related features such as Hybrid Connections are not supported for Azure Functions that are on a consumption plan. If you want to use a VPN\VNET and\or Hybrid Connection you will need to use a standard app service plan unfortunately.

If you have to use a consumption plan for your function then I typically will break out my on site data request (SQL, whatever) in a separate API and host just that within a resource that supports the connectivity needs (Standard App Service, VM, Container, etc). Your function can then consume that API (careful w/ overloading your downstream data requests)

Once you have configured your Hybrid Connection and installed the client on your local network then the configuration is generally seamless. Essentially your connection string to SQL will be the same as the connection string you use locally when on your own network.