简体   繁体   中英

How do you connect an Azure Function (not an App Service) to an on-premise SQL server via a VPN?

I have a large SQL server hosted in our infrastructure, and an Azure resource set up with VPN access to our servers.

I want to create an Azure Function that connects to this SQL server. It's going to be a webhook endpoint to save to that DB. I don't need the overhead of an App Service Plan, I want the lightweight Function and the cheaper consumption pricing model.

All the tutorials online refer to App Services and Hybrid Connections that don't appear to be available in to Azure Functions on Consumption Plans.

I also want to keep the connection string configuration in Azure, and not hard-coded in the source or publish (which will ultimately be via CI).

The Azure Function is currently coded in C# in VS2019, but I can change that if it helps.

How do I set this up?

Yes it is possible. You would need to use something like Hybrid Connection. Does not matter which IDE you used to create the function.Check out the following link.

The Hybrid Connections feature requires a relay agent in the network that hosts your Hybrid Connection endpoint. That relay agent is called the Hybrid Connection Manager (HCM). To download HCM, from your app in the Azure portal, select Networking > Configure your Hybrid Connection endpoints.

Azure App Service Hybrid Connections

This option is not available on consumption plan. There is a already user voice open for this.

https://feedback.azure.com/forums/355860-azure-functions/suggestions/33398398-add-support-for-hybrid-connections-to-consumption

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM