Direct web traffic with Azure Application Gateway

  1. Home
  2. Direct web traffic with Azure Application Gateway

Go back to Tutorial

In this tutorial, we will learn about Azure PowerShell to create an application gateway. However, the application gateway directs application web traffic to specific resources in a backend pool. You assign listeners to ports, create rules, and add resources to a backend pool.

Create a resource group

Use the New-AzResourceGroup cmdlet to establish a new resource group:

Azure PowerShell
New-AzResourceGroup -Name myResourceGroupAG -Location eastus

Create network resources

A virtual network is required for Azure to interact between the resources you construct. Only application gateways are allowed in the application gateway subnet. Other resources are not permitted. You can utilize an existing subnet or build a new one for Application Gateway. In this example, two subnets are created: one for the application gateway and the other for the backend servers. Depending on your needs, you may make the Application Gateway’s Frontend IP Public or Private. You’ll use a Public Frontend IP in this example.

  • Firstly, Create the subnet configurations using New-AzVirtualNetworkSubnetConfig.
  • Secondly, Create the virtual network with the subnet configurations using New-AzVirtualNetwork.
  • Lastly, Create the public IP address using New-AzPublicIpAddress.
AZ-104  practice tests

Create an application gateway

Create the IP configurations and frontend port
  1. Firstly, Use New-AzApplicationGatewayIPConfiguration to create the configuration that associates the subnet you created with the application gateway.
  2. Secondly, Use New-AzApplicationGatewayFrontendIPConfig to create the configuration that assigns the public IP address that you previously created to the application gateway.
  3. Lastly, Use New-AzApplicationGatewayFrontendPort to assign port 80 to access the application gateway.
Direct web traffic with Azure Application Gateway
Create the backend pool
  1. Firstly, Use New-AzApplicationGatewayBackendAddressPool to create the backend pool for the application gateway. The backend pool will be empty for now. When you create the backend server NICs in the next section, you will add them to the backend pool.
  2. Then, Configure the settings for the backend pool with New-AzApplicationGatewayBackendHttpSetting.
Direct web traffic with Azure Application Gateway
Create the application gateway

Now that you’ve created the necessary supporting resources, create the application gateway:

  1. Firstly, Use New-AzApplicationGatewaySku to specify parameters for the application gateway.
  2. Then, Use New-AzApplicationGateway to create the application gateway.
create application gateway

Backend servers

Create the backend virtual machines that will host the websites now that you’ve finished with the Application Gateway. NICs, virtual machine scale sets, public IPs, internal IPs, fully qualified domain names (FQDN), and multi-tenant backends like Azure App Service may all be found in the backend. In this example, you’ll utilise Azure to establish two virtual machines that will function as the application gateway’s backend servers. You must also install IIS on the virtual machines to ensure that Azure generated the application gateway correctly.

Create two virtual machines
  1. Firstly, Get the recently created Application Gateway backend pool configuration with Get-AzApplicationGatewayBackendAddressPool.
  2. Secondly, Create a network interface with New-AzNetworkInterface.
  3. Thirdly, Create a virtual machine configuration with New-AzVMConfig.
  4. Lastly, Create the virtual machine with New-AzVM.

Test the application gateway

Despite the fact that IIS isn’t necessary to establish the application gateway, you installed it in this quickstart to ensure that Azure created it successfully. To test the application gateway, use IIS:

  • Firstly, Run Get-AzPublicIPAddress to get the public IP address of the application gateway.
  • Secondly, Copy and paste the public IP address into the address bar of your browser. When you refresh the browser, you should see the name of the virtual machine.

Azure PowerShell
Get-AzPublicIPAddress -ResourceGroupName myResourceGroupAG -Name myAGPublicIPAddress

Direct web traffic with Azure Application Gateway AZ-104 online course

Reference: Microsoft Documentation

Go back to Tutorial

Menu