An Azure service that provides an event-driven serverless compute platform.
Well, i understand that you want to attach an existing Azure Functions Flex Consumption app to a subnet delegated to Microsoft.App/environments, then allow that subnet to reach Azure SQL. You also want a scoped operation, controlled provider registration, and checks before continuing.
I think Azure SQL virtual-network rules require the referenced subnet to have the Microsoft.Sql service endpoint enabled as enforced in current Flex Consumption networking guidance; in fact its integration subnet must not already be used for service endpoints. Based on published requirements, I dont wnow if that the same subnet can safely satisfy both requirements.
For a private, supported setup, i suggest using Azure SQL Private Link instead:
- Keep the Function’s VNet integration subnet dedicated to Flex and delegated to
Microsoft.App/environments. - Create the Azure SQL private endpoint in a separate subnet.
- Configure the
privatelink.database.windows.netprivate DNS zone and link it to the VNet used by the Function. - Verify that the Function resolves the SQL server name to the private endpoint address and can connect to SQL.
- Disable public network access on the SQL server if the intended design is private-only.
Flex Consumption routes traffic through its integrated VNet; no separate Route All setting is required for this plan. If you specifically require an Azure SQL virtual-network rule instead of Private Link, ask Microsoft to clarify whether enabling the SQL service endpoint on a Flex integration subnet is supported under the current subnet guidance before proceeding.
For the attachment operation, Microsoft documents az functionapp vnet-integration add for an existing Function App. The Microsoft.App provider must be registered. And if the deployment process must fail closed when registration is missing, have the platform team register it beforehand and verify that its state is Registered; do not grant the deployment identity provider-registration rights.
The documented Web Apps Update REST operation is also a PATCH, and its resource model includes properties.virtualNetworkSubnetId. A request body can set that property alone. So read the Function App configuration before and after the change and confirm the subnet association and the settings you need to preserve, and if your policy requires redirects to be rejected, use an HTTP client configured to stop on redirects. Caveat: az rest follows redirects.
After attachment, verify the subnet association using the Function App readback and the VNet integration listing and then test DNS resolution and an actual SQL connection from the Function App. Another caveat: successful ARM update alone does not prove that DNS, routing, firewall policy, and SQL authentication all work together.
Microsoft references:
- Flex Consumption networking and subnet requirements
- Azure Functions networking options
- Web Apps Update REST API
- Azure SQL virtual-network rules and service endpoints
- Connect to Azure SQL with a private endpoint
I hope this is helpful, so please upvote the answer if the information helped you.
This answer was partially prepared and fully translated into English with assistance from AI (ChatGPT/Mistral AI). I reviewed the technical claims against previeous experience and the updated Microsoft documentation linked above.
Ciao