app gateway lab1 - setting up app gateway for vm
To get started
1. create your app gateway - Goto Azure -> Create Application Gateway
Resource group: aprg
Application Gateway Name: ap
Tier: Standard: V2
Enable autoscaling: No
Instance Count: 1
Availability zone: Zones 1
Under Virtual Network
- Create your virtual network if you do not have one. Please note you need to create a default and another subnet for backend pool.
The portal does not allow you to add another subnet which you may need to add later.
In the front-end, ensure you create a public IP by clicking on "Add new".
Under backend tab click on "Add a backend pool".
Name: APBackendPool
Add backend pool without adding target: Yes
Click Add.
Configuration
Under the configuration tab, click on "Add a routing rule". We will only be configuring HTTP rules to port 80.
Rule name: HttpRoutingRule
Priority: 100
Listener tab
In the Listener tab, use the following settings for a listener.
Listener Name: HTTP
Front end IP: Public IPv4
Port: 80
Backend Target Tab
Target Type: Backend Pool
Backend Target: Select APBackendPool
Backend Settings: Click on Add new and setup backendSettings for HTTP
Click on "Add"
Then go straight to "Review and Create". this will take about 15 min to complete.
2. create your VM
Next start creating your virtual machine. We will be creating 1 VM.Then enter your username and password
In the In the inbound port: select HTTP, HTTPS and RDP port as shown above.
In Networking tab, ensure you select None for public ip.
Subnet is: BackendPoolSubnet
Enable Inbound port for: http, https and RDP
Leave the rest as it is. Click on Review and Create.
Once your VM is up and running, goto cloud shell and run the following command to setup IIS
Set-AzVMExtension -ResourceGroupName mylbrg -ExtensionName IIS -VMName VM1 -Publisher Microsoft.Compute -ExtensionType CustomScriptExtension -TypeHandlerVersion 1.4 -SettingString '{"commandToExecute":"powershell Add-WindowsFeature Web-Server; powershell Add-Content -Path \"C:\\inetpub\\wwwroot\\Default.htm\" -Value $($env:computername)"}' -Location AustraliaEast
3. Test out the setup
Goto your load balancer and then copy its public IP address. Paste it in your browser, your should see a page loaded with your VM name.
Comments