I have an Azure Function that connects to an Azure Database for PostgreSQL flexible server, but I am getting a timeout (while from my local I can do it without any problem). After some research, I found out that the pricing tier of the Function App’s plan is set to Consumption, and I cannot modify outbound traffic without upgrading it. Is there any way to be able to connect without upgrading? I think it is too expensive just for a single function that is triggered once a day on average…
Also important: the network connectivity for the database is set to Private access (VNet Integration).
Thanks in advance!
2
Answers
While Peter Bons is totally right, there is a workaround I would like to share in case anyone is facing the same problem, and it is that you can use Azure AD authentication with PostgreSQL Flexible Servers.
To sum up, you can create a provisional token linked to an object id that can be used to connect to the database from an Azure Function.
I followed the tutorial in this link and worked pretty good.
No, if you do need VNET integration for azure functions you cannot use the consumption plan. It is an annoying downside. Requests for support of VNET is open since 2018, see this issue.
The alternatives are upgrading to a premium plan or host the function on an Azure App Service plan that supports VNET integration.