Edit

Share via


Enable virtual network integration in Azure App Service

This article describes how to integrate Azure Virtual Network with Azure App Service. The integration enables you to reach private resources from your App Service app within your Azure virtual network. Procedures are provided for the Azure portal, the Azure CLI, and Azure PowerShell.

Prerequisites

  • An existing app created in a dedicated Azure App Service compute pricing tier that supports virtual network integration.

    • If you plan to allow inbound access via private endpoints on a subnet, public access must be disabled for the app.
  • The Azure virtual network and subnet that you specify for the integration must be in the same region.

    • The subnet must be allocated an IPv4 /28 block (16 addresses). The recommended minimum size is 64 addresses (IPv4 /26 block), which accommodates future growth and scaling needs.

    • The subnet must be empty, which means no network interface cards (NICs), virtual machines, private endpoints, and so on.

    • The subnet must be delegated to Microsoft.Web/serverFarms. If you don't delegate before integration, the provisioning process configures this delegation.

  • If the specified virtual network is in different subscription than your app, confirm the virtual network subscription is registered with the Microsoft.Web resource provider.

    The resource provider is registered when you create the first web app in a subscription. To explicitly register the provider, see Azure resource providers and types > Register resource provider.

Configure virtual network integration

Choose your preferred configuration method for completing the virtual network integration.

Configure virtual network integration for an app in the Azure portal:

  1. Sign into the Azure portal and go to the Overview page for your App Service app.

  2. In the left menu, select Settings > Networking. The Networking page opens.

  3. Scroll to the Outbound traffic configuration section, locate the Virtual network integration option, and select the Not configured link.

    Screenshot that shows how to select the 'not configured' link for virtual network integration in the Azure portal.

    The Virtual Network Integration page opens.

  4. Select Add virtual network integration.

    Screenshot that shows how to select the 'add virtual network integration' action in the Azure portal.

    The Add virtual network integration page opens.

  5. Select the App Service Plan connection to use for the integration.

    • If your subscription has an existing plan that satisfies the integration configuration requirements, the portal displays the available <virtual-network>/<subnet> connection targets.

      • To use an existing connection, select the <virtual-network>/<subnet> target, and then select Connect.

      The procedure is complete.

    • To create a new plan for the integration, select New connection.

      The page refreshes to show the Subscription, Virtual Network, and Subnet options.

      Configure the options to create a new connection:

      1. Select a Subscription and a Virtual Network by using the dropdown lists.

      2. Select a Subnet from the dropdown list, and then select Connect.

        The dropdown list shows all the virtual networks (and subnets) in the selected subscription and in the same region. The list identifies subnets available for integration, and indicates whether they're currently in use.

      Screenshot that shows how to select the subscription, virtual network, and subnet to create a new connection in the Azure portal.

During the integration, your app restarts. When integration completes, the Virtual Network Integration page refreshes to show the details about the connection between the virtual network and your app.

Screenshot of the virtual network integration to an app in the Azure portal.