Create Virtual Network for Azure App Services and Azure SQL Database

Raymond Raymond event 2021-05-18 visibility 2,143
more_vert
Create Virtual Network for Azure App Services and Azure SQL Database

Azure virtual networks can be used to connect Azure resources to each other. Virtual network can also connect to on-premises network using Azure VPN gateway. This article shows the steps required to create a virtual network to connect Azure Web Service to Azure SQL database.

Create virtual network

First, we need to create a virtual network. 

  1. Logon to Microsoft Azure portal.
  2. Search for and navigate to Virtual networks.
  3. Click Create virtual network button or + Create button.
  4. Input virtual network details including subscription, resource group, network name and region.
    20210518115021-image.png
  5. Input IP addresses details. For this tutorial, I will directly use the default values (10.0.0.0/16).
  6. Configure security settings accordingly. 

Add SQL database to virtual network

For existing SQL database on Azure, follow these steps to add it to the virtual network:

  1. Go to Azure SQL server blade.
  2. Click Security -> Firewalls and virtual networks.
  3. Go to Virtual networks section:
    2021122832804-image.png
  4. Click link '+ Add existing virtual network'.
  5. Input the details and select the previously created virtual network:
    2021122833032-image.png
  6. Click enable button to enable it.

Add App service to virtual network

For App service plans, only standard and above plans support virtual networks. Thus to add an app service to a virtual network, please ensure you service plan is at least S1:

2021122833930-image.png

And also please ensure the region of the VNet is the same as your app service; otherwise you won't be able to select the virtual network to integrate. 

Now follow these steps to add App service to a virtual network:

  1. Go to the App Service blade.
  2. Click Settings -> Networking.
    2021122834717-image.png
  3. Click 'VNet integration' link in Outbound Traffic card.
  4. Click '+ Add VNet' button:
    2021122834810-image.png
  5. Select the virtual network:
    2021122840913-image.png
  6. You can use existing subnet or creating a new one. For this case, I am using the default subnet.
  7. Click OK button to save the changes.
  8. Once it is done, the blade looks like the following screenshot:
    2021122841017-image.png

Now the SQL database server and App services are both added into the same VNet.

More from Kontext
comment Comments
No comments yet.

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts