Create a Public Load balancer

Sign in to Azure

Sign in to the Azure portal at https://portal.azure.com.

Create the virtual network:

In this section, you'll create a virtual network and subnet.

  1. In the search box at the top of the portal, enter Virtual network. Select Virtual Networks in the search results.

  2. In Virtual networks, select + Create.

  3. In Create virtual network, enter or select this information in the Basics tab:

    TABLE 1
    SettingValue
    Project Details
    SubscriptionSelect your Azure subscription
    Resource GroupSelect Create new.
    In Name enter CreatePubLBQS-rg.
    Select OK.
    Instance details
    NameEnter myVNet
    RegionSelect (Europe) West Europe
  4. Select the IP Addresses tab or select the Next: IP Addresses button at the bottom of the page.

  5. In the IP Addresses tab, enter this information:

    TABLE 2
    SettingValue
    IPv4 address spaceEnter 10.1.0.0/16
  6. Under Subnet name, select the word default.

  7. In Edit subnet, enter this information:

    TABLE 3
    SettingValue
    Subnet nameEnter myBackendSubnet
    Subnet address rangeEnter 10.1.0.0/24
  8. Select Save.

  9. Select the Security tab.

  10. Under BastionHost, select Enable. Enter this information:

    TABLE 4
    SettingValue
    Bastion nameEnter myBastionHost
    AzureBastionSubnet address spaceEnter 10.1.1.0/27
    Public IP AddressSelect Create new.
    For Name, enter myBastionIP.
    Select OK.
  11. Select the Review + create tab or select the Review + create button.

  12. Select Create.

Create NAT gateway

In this section, you'll create a NAT gateway for outbound internet access for resources in the virtual network.

  1. In the search box at the top of the portal, enter NAT gateway. Select NAT gateways in the search results.

  2. In NAT gateways, select + Create.

  3. In Create network address translation (NAT) gateway, enter or select the following information:

    TABLE 5
    SettingValue
    Project details
    SubscriptionSelect your subscription.
    Resource groupSelect CreatePubLBQS-rg.
    Instance details
    NAT gateway nameEnter myNATgateway.
    Availability zoneSelect None.
    Idle timeout (minutes)Enter 15.
  4. Select the Outbound IP tab or select the Next: Outbound IP button at the bottom of the page.

  5. In Outbound IP, select Create a new public IP address next to Public IP addresses.

  6. Enter myNATGatewayIP in Name in Add a public IP address.

  7. Select OK.

  8. Select the Subnet tab or select the Next: Subnet button at the bottom of the page.

  9. In Virtual network in the Subnet tab, select myVNet.

  10. Select myBackendSubnet under Subnet name.

  11. Select the blue Review + create button at the bottom of the page, or select the Review + create tab.

  12. Select Create.

Create load balancer

In this section, you'll create a zone redundant load balancer that load balances virtual machines. With zone-redundancy, one or more availability zones can fail and the data path survives as long as one zone in the region remains healthy.

During the creation of the load balancer, you'll configure:

  • Frontend IP address
  • Backend pool
  • Inbound load-balancing rules
  1. In the search box at the top of the portal, enter Load balancer. Select Load balancers in the search results.

  2. In the Load balancer page, select Create.

  3. In the Basics tab of the Create load balancer page, enter, or select the following information:

    TABLE 6
    SettingValue
    Project details
    SubscriptionSelect your subscription.
    Resource groupSelect CreatePubLBQS-rg.
    Instance details
    NameEnter myLoadBalancer
    RegionSelect (Europe) West Europe.
    TypeSelect Public.
    SKULeave the default Standard.
    TierLeave the default Regional.





  4. Select Next: Frontend IP configuration at the bottom of the page.

  5. In Frontend IP configuration, select + Add a frontend IP.

  6. Enter LoadBalancerFrontend in Name.

  7. Select IPv4 or IPv6 for the IP version.

     Note

    IPv6 isn't currently supported with Routing Preference or Cross-region load-balancing (Global Tier).

  8. Select IP address for the IP type.

     Note

    For more information on IP prefixes, see Azure Public IP address prefix.

  9. Select Create new in Public IP address.

  10. In Add a public IP address, enter myPublicIP for Name.

  11. Select Zone-redundant in Availability zone.

     Note

    In regions with Availability Zones, you have the option to select no-zone (default option), a specific zone, or zone-redundant. The choice will depend on your specific domain failure requirements. In regions without Availability Zones, this field won't appear.
    For more information on availability zones, see Availability zones overview.

  12. Leave the default of Microsoft Network for Routing preference.

  13. Select OK.

  14. Select Add.

  15. Select Next: Backend pools at the bottom of the page.

  16. In the Backend pools tab, select + Add a backend pool.

  17. Enter myBackendPool for Name in Add backend pool.

  18. Select myVNet in Virtual network.

  19. Select NIC or IP Address for Backend Pool Configuration.

  20. Select IPv4 or IPv6 for IP version.

  21. Select Add.

  22. Select the Next: Inbound rules button at the bottom of the page.

  23. In Load balancing rule in the Inbound rules tab, select + Add a load balancing rule.

  24. In Add load balancing rule, enter or select the following information:

    TABLE 7
    SettingValue
    NameEnter myHTTPRule
    IP VersionSelect IPv4 or IPv6 depending on your requirements.
    Frontend IP addressSelect LoadBalancerFrontend.
    ProtocolSelect TCP.
    PortEnter 80.
    Backend portEnter 80.
    Backend poolSelect myBackendPool.
    Health probeSelect Create new.
    In Name, enter myHealthProbe.
    Select HTTP in Protocol.
    Leave the rest of the defaults, and select OK.
    Session persistenceSelect None.
    Idle timeout (minutes)Enter or select 15.
    TCP resetSelect Enabled.
    Floating IPSelect Disabled.
    Outbound source network address translation (SNAT)Leave the default of (Recommended) Use outbound rules to provide backend pool members access to the internet.
  25. Select Add.

  26. Select the blue Review + create button at the bottom of the page.

  27. Select Create.

Create virtual machines

In this section, you'll create three VMs (myVM1myVM2 and myVM3) in three different zones (Zone 1Zone 2, and Zone 3).

These VMs are added to the backend pool of the load balancer that was created earlier.

  1. In the search box at the top of the portal, enter Virtual machine. Select Virtual machines in the search results.

  2. In Virtual machines, select + Create > Virtual machine.

  3. In Create a virtual machine, type or select the values in the Basics tab:

    TABLE 8
    SettingValue
    Project Details
    SubscriptionSelect your Azure subscription
    Resource GroupSelect CreatePubLBQS-rg
    Instance details
    Virtual machine nameEnter myVM1
    RegionSelect (Europe) West Europe
    Availability OptionsSelect Availability zones
    Availability zoneSelect 1
    ImageSelect Windows Server 2019 Datacenter - Gen1
    Azure Spot instanceLeave the default of unchecked.
    SizeChoose VM size or take default setting
    Administrator account
    UsernameEnter a username
    PasswordEnter a password
    Confirm passwordReenter password
    Inbound port rules
    Public inbound portsSelect None
  4. Select the Networking tab, or select Next: Disks, then Next: Networking.

  5. In the Networking tab, select or enter:

    TABLE 9
    SettingValue
    Network interface
    Virtual networkmyVNet
    SubnetmyBackendSubnet
    Public IPSelect None.
    NIC network security groupSelect Advanced
    Configure network security groupSelect Create new.
    In the Create network security group, enter myNSG in Name.
    Under Inbound rules, select +Add an inbound rule.
    Under Service, select HTTP.
    Under Priority, enter 100.
    In Name, enter myNSGRule
    Select Add
    Select OK
    Load balancing
    Place this virtual machine behind an existing load-balancing solution?Select the check box.
    Load balancing settings
    Load-balancing optionsSelect Azure load balancing
    Select a load balancerSelect myLoadBalancer
    Select a backend poolSelect myBackendPool
  6. Select Review + create.

  7. Review the settings, and then select Create.

  8. Follow the steps 1 through 7 to create two more VMs with the following values and all the other settings the same as myVM1:

    TABLE 10
    SettingVM 2VM 3
    NamemyVM2myVM3
    Availability zone23
    Network security groupSelect the existing myNSGSelect the existing myNSG


Install IIS

  1. In the search box at the top of the portal, enter Virtual machine. Select Virtual machines in the search results.

  2. Select myVM1.

  3. On the Overview page, select Connect, then Bastion.

  4. Select Use Bastion.

  5. Enter the username and password entered during VM creation.

  6. Select Connect.

  7. On the server desktop, navigate to Windows Administrative Tools > Windows PowerShell.

  8. In the PowerShell Window, run the following commands to:

    • Install the IIS server
    • Remove the default iisstart.htm file
    • Add a new iisstart.htm file that displays the name of the VM:
    PowerShell
# Install IIS server role
Install-WindowsFeature -name Web-Server -IncludeManagementTools
# Remove default htm file
Remove-Item C:\inetpub\wwwroot\iisstart.htm
# Add a new htm file that displays server name
Add-Content -Path "C:\inetpub\wwwroot\iisstart.htm" -Value $("Hello Batch 7 Team - This website is from " + $env:computername)


     9. Close the Bastion session with myVM1.

    10. Repeat steps 1 to 8 to install IIS and the updated iisstart.htm file                         on myVM2 and myVM3.

Test the load balancer

  1. In the search box at the top of the page, enter Load balancer. Select Load balancers in the search results.

  2. Find the public IP address for the load balancer on the Overview page under Public IP address.

  3. Copy the public IP address, and then paste it into the address bar of your browser. The custom VM page of the IIS Web server is displayed in the browser.









Clean up resources:

When no longer needed, delete the resource group, load balancer, and all related resources. To do so, select the resource group CreatePubLBQS-rg that contains the resources and then select Delete.


Comments

Post a Comment

Popular posts from this blog

How do I Create an Azure Storage Account?

Configure Point-to-Site Connection