7

I am trying to connect my new Azure Function to an on-premises SQL Server database. The Microsoft docs mention that this is possible, but I have not been able to figure it out nor have I seen any tutorials about specifically setting up a on-premises db with Azure Functions.

I want to do something similar to this tutorial.

public static async void Run(TimerInfo myTimer, TraceWriter log)
{
    var str = ConfigurationManager.ConnectionStrings["on-prem-connection"].ConnectionString;

    //open connections and call db here - I know this
}

Can I do it in a similar way to the video above where I set up a connection string and then reference that connections string in the Azure Function. If so how is that done.

Thanks you.

1
  • 1
    Are you asking how to do the code part in Azure Functions or how to connect to on-premises? Commented May 23, 2016 at 21:43

6 Answers 6

9

You would need to use something like Hybrid Connection. Check out the following link. I hope it helps: https://azure.microsoft.com/en-us/documentation/articles/web-sites-hybrid-connection-connect-on-premises-sql-server/

Sign up to request clarification or add additional context in comments.

1 Comment

Wouldn't the latency cause some issues or does Hybrid Connection make the connection fast enough?
0

Possible but using Azure function as deployed under App Service Plan.

Go to "Platform Features" and select "Networking" - there you will get the option to setup the Hybrid connection for the Azure Function.

Comments

0

If you are using Linux app service plan, this is impossible. Hybrid connectins just supported by Windows type app services. You can use Vnets on Linux app service plans.

1 Comment

It appears that as of 6/2020 Linux apps are now supported: azure.microsoft.com/en-us/updates/…
0

You can connect to your onpremise sql serve via virtual machine linux or windows. You can connect your virtual machine to vpn gateway enabled vnet.

Comments

0

Using VNET Integration, FunctionApp can connect to on-premise SQL / services. To begin with go with the IP of the on-premise servers (not by DNS).

It's AppsServicePlan requires to be on Standard, Premium V2's.

The subnet on the VNET must be configured appropriately to allow the RFC1918 traffic. The setup will consist of using an site2site vpn gateway if not on ExpressRoute.

Comments

-4

Check this Microsoft tutorial. In regards to on premises database, you just need to replace the connection string with appropriate permission.

Use Azure functions to connect to Sql database

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.