About This Page
This page is part of the Azure documentation. It contains code examples and configuration instructions for working with Azure services.
Bias Analysis
Bias Types:
⚠️
powershell_heavy
⚠️
windows_first
⚠️
missing_linux_example
⚠️
windows_tools
Summary:
The documentation is heavily biased towards Windows and PowerShell. All examples use Azure PowerShell cmdlets, and the only operating system referenced for VM creation and configuration is Windows Server. Steps for installing IIS and testing the load balancer are specific to Windows (e.g., using PowerShell commands, Internet Explorer, and Windows-specific VM images). There are no equivalent instructions or examples for Linux users, such as using Azure CLI, Bash, or deploying Linux VMs and web servers (e.g., Apache or Nginx).
Recommendations:
- Provide parallel examples using Azure CLI (az commands) and Bash scripts for all resource creation and configuration steps.
- Include instructions and code samples for deploying Linux-based VMs (e.g., Ubuntu) in the backend pool, with examples of installing and configuring a Linux web server (such as Apache or Nginx) using cloud-init or custom script extensions.
- When demonstrating VM creation, show both Windows and Linux image options, and explain how to set up credentials for each.
- In the 'Test the load balancer' section, describe how to connect to a Linux VM (e.g., using SSH via Bastion or Cloud Shell) and test the web server using curl or a browser.
- Avoid referencing Windows-only tools (like Internet Explorer) as the default; mention cross-platform alternatives.
- Consider restructuring the documentation to present both Windows and Linux paths side-by-side, or provide clear navigation to Linux-specific quickstarts.
Create pull request
Flagged Code Snippets
## Configure virtual network
When you create an internal load balancer, a virtual network is configured as the network for the load balancer. Before you deploy VMs and test your load balancer, create the supporting virtual network resources.
Create a virtual network for the backend virtual machines
Create a network security group to define inbound connections to your virtual network
Create an Azure Bastion host to securely manage the virtual machines in the backend pool
### Create virtual network, network security group and bastion host
* Create a virtual network with [New-AzVirtualNetwork](/powershell/module/az.network/new-azvirtualnetwork)
* Create a network security group rule with [New-AzNetworkSecurityRuleConfig](/powershell/module/az.network/new-aznetworksecurityruleconfig)
* Create an Azure Bastion host with [New-AzBastion](/powershell/module/az.network/new-azbastion)
> [!IMPORTANT]
> [!INCLUDE [Pricing](~/reusable-content/ce-skilling/azure/includes/bastion-pricing.md)]
>
## Create virtual machines
In this section, you'll create the two virtual machines for the backend pool of the load balancer.
* Create three network interfaces with [New-AzNetworkInterface](/powershell/module/az.network/new-aznetworkinterface)
* Set an administrator username and password for the VMs with [Get-Credential](/powershell/module/microsoft.powershell.security/get-credential)
* Use [New-AzAvailabilitySet](/powershell/module/az.compute/new-azvm) to create an availability set for the virtual machines.
* Create the virtual machines with:
* [New-AzVM](/powershell/module/az.compute/new-azvm)
* [New-AzVMConfig](/powershell/module/az.compute/new-azvmconfig)
* [Set-AzVMOperatingSystem](/powershell/module/az.compute/set-azvmoperatingsystem)
* [Set-AzVMSourceImage](/powershell/module/az.compute/set-azvmsourceimage)
* [Add-AzVMNetworkInterface](/powershell/module/az.compute/add-azvmnetworkinterface)
The deployments of the virtual machines and bastion host are submitted as PowerShell jobs. To view the status of the jobs, use [Get-Job](/powershell/module/microsoft.powershell.core/get-job):
## Create load balancer
This section details how you can create and configure the following components of the load balancer:
* Create a frontend IP with [New-AzLoadBalancerFrontendIpConfig](/powershell/module/az.network/new-azloadbalancerfrontendipconfig) for the frontend IP pool. This IP receives the incoming traffic on the load balancer
* Create a backend address pool with [New-AzLoadBalancerBackendAddressPoolConfig](/powershell/module/az.network/new-azloadbalancerbackendaddresspoolconfig) for traffic sent from the frontend of the load balancer
* Create a health probe with [Add-AzLoadBalancerProbeConfig](/powershell/module/az.network/add-azloadbalancerprobeconfig) that determines the health of the backend VM instances
* Create a load balancer rule with [Add-AzLoadBalancerRuleConfig](/powershell/module/az.network/add-azloadbalancerruleconfig) that defines how traffic is distributed to the VMs
* Create a public load balancer with [New-AzLoadBalancer](/powershell/module/az.network/new-azloadbalancer)
[!INCLUDE [ephemeral-ip-note.md](~/reusable-content/ce-skilling/azure/includes/ephemeral-ip-note.md)]
## Create the test virtual machine
Create the virtual machine with:
* [New-AzNetworkInterface](/powershell/module/az.network/new-aznetworkinterface)
* [New-AzVM](/powershell/module/az.compute/new-azvm)
* [New-AzVMConfig](/powershell/module/az.compute/new-azvmconfig)
* [Set-AzVMOperatingSystem](/powershell/module/az.compute/set-azvmoperatingsystem)
* [Set-AzVMSourceImage](/powershell/module/az.compute/set-azvmsourceimage)
* [Add-AzVMNetworkInterface](/powershell/module/az.compute/add-azvmnetworkinterface)
## Install IIS
Use [Set-AzVMExtension](/powershell/module/az.compute/set-azvmextension) to install the Custom Script Extension.
The extension runs `PowerShell Add-WindowsFeature Web-Server` to install the IIS webserver and then updates the Default.htm page to show the hostname of the VM:
> [!IMPORTANT]
> Ensure the virtual machine deployments have completed from the previous steps before proceeding. Use `Get-Job` to check the status of the virtual machine deployment jobs.
The extensions are deployed as PowerShell jobs. To view the status of the installation jobs, use [Get-Job](/powershell/module/microsoft.powershell.core/get-job):
> [!IMPORTANT]
> Ensure the custom script extension deployments have completed from the previous steps before proceeding. Use `Get-Job` to check the status of the deployment jobs.
## Test the load balancer
1. [Sign in](https://portal.azure.com) to the Azure portal.
1. Find the private IP address for the load balancer on the **Overview** screen. Select **All services** in the left-hand menu, select **All resources**, and then select **myLoadBalancer**.
2. Make note or copy the address next to **Private IP Address** in the **Overview** of **myLoadBalancer**.
3. Select **All services** in the left-hand menu, select **All resources**, and then from the resources list, select **myTestVM** that is located in the **CreateIntLBQS-rg** resource group.
4. On the **Overview** page, select **Connect**, then **Bastion**.
6. Enter the username and password entered during VM creation.
7. Open **Internet Explorer** on **myTestVM**.
8. Enter the IP address from the previous step into the address bar of the browser. The default page of IIS Web server is displayed on the browser.
To see the load balancer distribute traffic across all three VMs, you can customize the default page of each VM's IIS Web server and then force-refresh your web browser from the client machine.
## Clean up resources
When no longer needed, you can use the [Remove-AzResourceGroup](/powershell/module/az.resources/remove-azresourcegroup) command to remove the resource group, load balancer, and the remaining resources.