Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
17 views
Create An Internal Load Balancer Via CLI
Uploaded by
Sanskar
AI-enhanced title
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Create an internal load balancer via CLI For Later
Download
Save
Save Create an internal load balancer via CLI For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
17 views
Create An Internal Load Balancer Via CLI
Uploaded by
Sanskar
AI-enhanced title
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Create an internal load balancer via CLI For Later
Carousel Previous
Carousel Next
Save
Save Create an internal load balancer via CLI For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 12
Search
Fullscreen
1125124, 7:34 PM (ickstar: Create an internal load balancer - Azure CL - Azure Load Balancer | Microsoft Leam Quickstart: Create an internal load balancer to load balance VMs using the Azure CLI Article + 08/24/2023 Get started with Azure Load Balancer by using the Azure CLI to create an internal load balancer and two virtual machines. Additional resources include Azure Bastion, NAT Gateway, a virtual network, and the required subnets. fig) reateiet8as-15 myloadBalancer moral, Ed ~~ ca myPubliP —— i ye imyBackendPoo! ee = cae eg ee A view imyNAtgatewaylP myNATgateway ey ROP/SSH ~ myBackendSubnet | >K mypostonsiost FEY mytastone © BastionSubnet If you don't have an Azure subscription, create an Azure free account _ before you begin. Prerequisites * Use the Bash environment in Azure Cloud Shell. For more information, see Quickstart for Bash in Azure Cloud Shell. ntips:leam microsot.comlen-uslazureload-balanceriquickstartoae-balancer-standar-ntemabli se112504, 7:94 Pm Cuikstart Crete an internal loa blancor- Azure CL -Azure Load Balancer | Microsoft Loam ‘* Ifyou prefer to run CLI reference commands locally, install the Azure CLI. If you're running on Windows or macOS, consider running Azure CLI in a Docker container. For more information, see How to run the Azure CLI in a Docker container. © Ifyou're using a local installation, sign in to the Azure CLI by using the az login command. To finish the authentication process, follow the steps displayed in your terminal. For other sign-in options, see Sign in with the Azure CLL © When you're prompted, install the Azure CLI extension on first use. For more information about extensions, see Use extensions with the Azure CLI. © Run az version to find the version and dependent libraries that are installed. To upgrade to the latest version, run az upgrade. © This quickstart requires version 2.0.28 or later of the Azure CLI. If you're using Azure Cloud Shell, the latest version is already installed. ~ Create a resource group ‘An Azure resource group is a logical container into which you deploy and manage your Azure resources. Create a resource group with az group create Azure CLI az group create \ --name CreateIntLBQs-rg \ --location westus3 When you create an internal load balancer, a virtual network is configured as the network for the load balancer. Create the virtual network Before you deploy VMs and test your load balancer, create the supporting virtual network and subnet. The virtual network and subnet contain the resources deployed later in this article. Create a virtual network by using az network vnet create. ntips:leam mierosot.comlen-uslazureload-balanceriquickstartoae-balancer-standar-nterabli ane1125124, 734 PM (ickstar: Create an internal load balancer - Azure CL - Azure Load Balancer | Microsoft Leam ‘Azure CLI az network vnet create \ --resource-group CreatelntL8Qs-rg \ --location westus3 \ name myVNet \ address-prefixes 10,1.0.0/16 \ subnet-name myBackendSubnet \ subnet-prefixes 10.1.0.0/24 Create an Azure Bastion host In this example, you create an Azure Bastion host. The Azure Bastion host is used later in this article to securely manage the virtual machines and test the load balancer deployment. © Important Hourly pricing starts from the moment that Bastion is deployed, regardless of outbound data usage. For more information, see Pricing and SKUs. If you're deploying Bastion as part of a tutorial or test, we recommend that you delete this resource after you finish using it. Create a bastion public IP address Use az network publi create to create a public IP address for the Azure Bastion host. ‘Azure CLI az network public-ip create \ --resource-group CreateIntLBQs-rg \ --name myBastionIP \ --sku Standard \ --zone 123 Create a bastion subnet Use az network vnet subnet create to create a subnet. ‘Aaure CLI ntips:leam microsot.comlen-uslazureload-balanceriquickstartoae-balancer-standar-ntemabli 321125124, 734 PM (ickstar: Create an internal load balancer Azure CL - Azure Load Balancer | Microsoft Leam az network vnet subnet create \ --pesource-group CreateIntLBQs-rg \. --name AzureBastionSubnet \ --vnet-name myVNet \ --address-prefixes 10.1.1.0/27 Create the bastion host Use az network bastion create to create a host. Azure CLI az network bastion create \ --resource-group CreateIntLBQs-rg \ name myBastionHost \ public-ip-address myBastionIP \ vnet-name myVNet \ Location westus3 It can take a few minutes for the Azure Bastion host to deploy. Create the load balancer This section details how you can create and configure the following components of the load balancer: * A frontend IP pool that receives the incoming network traffic on the load balancer * Abackend IP pool where the frontend pool sends the load balanced network traffic * Ahealth probe that determines health of the backend VM instances * Aload balancer rule that defines how traffic is distributed to the VMs Create the load balancer resource Create an internal load balancer with az network Ib create. ‘Azure CLI ntips:leam microsot.comlen-uslazureload-balanceriquickstartoae-balancer-standar-ntemabli12524, 7:24 PM (ickstar: Create an internal load balancer Azure CL - Azure Load Balancer | Microsoft Leam az network 1b create \ --pesource-group CreateIntLBQS-rg \ --name myLoadBalancer \ --sku Standard \ --vnet-name myVNet \ --subnet myBackendSubnet \ --backend-pool-name myBackEndPool \ --frontend-ip-name myFronténd Create the health probe A health probe checks all virtual machine instances to ensure they can send network traffic. A virtual machine with a failed probe check is removed from the load balancer. The virtual machine is added back into the load balancer when the failure is resolved. Create a health probe with az network lb probe create. ‘Azure CLI az network 1b probe create \ --resource-group CreateIntLBQs-rg \ --1b-name myLoadBalancer \ --name myHealthProbe \ =-protocol tcp \ --port 88 Create a load balancer rule A load balancer rule defines: ‘* Frontend IP configuration for the incoming traffic The backend IP pool to receive the traffic ‘© The required source and destination port Create a load balancer rule with az network Ib rule create. Azure CLI az network 1b rule create \ --resource-group CreateIntLaQs-rg \ ntips:leam mierosot.comlon-uslazureload-balanceriquickstartoae-balancer-standar-ntemabli 521125724, 7:34 PM Cuickstart Crete an ntrnl load balancer Azure CL Azure Load Balancer | Microsoft Leam =-Ib-nane myLoadBalancer \ =-name myHTTPRule \ =-protocol tep \ --frontend-port 8 \ =-backend-port 80 \ --frontend-ip-name myFronténd \ --backend-pool-name myBackEndPool \ --probe-name myHealthProbe \ --idle-timeout 15 \ --enable-tcp-reset true Create a network security group For a standard load balancer, the VMs in the backend pool are required to have network interfaces that belong to a network security group. To create a network security group, use az network nsg create Azure CLI az network nsg create \ --resource-group CreateIntLaQs-rg \ =-name myNSG Create a network security group rule To create a network security group rule, use az network nsg rule create. pour cu az network nsg rule create \ --resource-group CreateIntLBQS-rg \ --nsg-name myNSG \ =-name myNSGRuleHTTP \ --protocol '*" \ --direction inbound \ --source-address-prefix '*" \ --source-port-range '*" \ --destination-address-prefix --destination-port-range 8@ \ --access allow \ --priority 200 ntips:leam microsot.comlen-uslazureload-balanceriquickstartoae-balancer-standar-ntemabli 621125124, 7:34 PM (ickstar: Create an internal load balancer - Azure CL - Azure Load Balancer | Microsoft Leam Create back-end servers In this section, you create: * Two network interfaces for the virtual machines ‘* Two virtual machines to be used as servers for the load balancer Create network interfaces for the virtual machines Create two network interfaces with az network nic create. Azure CL! array=(myNicvitl myNicva2) for vmnic in "${array[@]}" do az network nic create \ --resource-group CreateIntL8Qs-rg \ name $vmnic \ ‘vnet-name myVNet \ --subnet myBackEndSubnet \ --network-security-group myNSG done Create the virtual machines Create the virtual machines with az vm create. Azure CLI array=(1 2) for n in "S{array[@]}" do az vm create \ --pesource-group CreateIntLBQS-rg \ =-name myVMgn \ nics myNicVM$n \ image win2e19datacenter \ ‘admin-username azureuser \ zone $n \ =-no-wait done ntips:leam microsot.comlen-uslazureload-balanceriquickstartoae-balancer-standar-ntemabli me1125124, 7:34 PM (ickstar: Create an internal load balancer - Azure CL - Azure Load Balancer | Microsoft Leam It can take a few minutes for the VMs to deploy. O Note Azure provides a default outbound access IP for VMs that either aren't assigned a public IP address or are in the back-end pool of an internal basic Azure load balancer. The default outbound access IP mechanism provides an outbound IP address that isn’t configurable, The default outbound access IP is disabled when one of the following events happens: * A public IP address is assigned to the VM * The VM is placed in the back-end pool of a standard load balancer, with or without outbound rules, * An Azure Virtual Network NAT gateway resource is assigned to the subnet of the VM. VMs that you create by using virtual machine scale sets in flexible orchestration mode don't have default outbound access. For more information about outbound connections in Azure, see Default outbound access in Azure and Use Source Network Address Translation (SNAT) for outbound connections. Add virtual machines to the backend pool ‘Add the virtual machines to the backend pool with az network nic ip-config address-pool add, ‘Azure CLI array=(Vid VM2) for vm in "S{array[@]}" do az network nic ip-config address-pool add \ address-pool myBackendPool \ p-config-name ipconfigi \ nic-name myNic$vm \ resource-group CreateIntLeQs-rg \ ‘Lb-name myLoadBalancer ntips:leam mierosot.comlon-uslazureload-balanceriquickstartoae-balancer-standar-ntemabli ana1125124, 734 PM (ickstar: Create an internal load balancer - Azure CL - Azure Load Balancer | Microsoft Leam done Create NAT gateway To provide outbound internet access for resources in the backend pool, create a NAT gateway. Create public IP Use az network public-ip create to create a single IP for the outbound connectivity. azure CU az network public-ip create \ =-resource-group CreaterntLBQs-rg \ --name myNATgatewayIP \ --sku Standard \ Create NAT gateway resource Use az network nat gateway create to create the NAT gateway resource. The public IP created in the previous step is associated with the NAT gateway. ‘Azure CLI az network nat gateway create \ ~-resource-group CreateIntLBQS-rg \ --nane myNATgateway \ =-public-ip-addresses myNATgatewayIP \ =-idle-timeout 1 Associate NAT gateway with subnet Configure the source subnet in virtual network to use a specific NAT gateway resource with az network vnet subnet update. ‘Azure CLI ntips:leam microsot.comlen-uslazureload-balanceriquickstartoae-balancer-standar-ntemabli ena1125124, 734 PM (ickstar: Create an internal load balancer Azure CL - Azure Load Balancer | Microsoft Leam az network vnet subnet update \ --pesource-group CreateIntLBQs-rg \ s-vnet-name myVNet \ =-name myBackendSubnet \ --nat-gateway myNATgateway Create test virtual machine Create the network interface with az network nic create. ‘Azure CLI az network nic create \ --resource-group CreateIntLBQs-rg \ --name myNicTestvM \ --vnet-name myVNet \ --subnet myBackEndSubnet \ --network-security-group myNSG Create the virtual machine with az vm create. ‘Azure CLI az vm create \ --resource-group CreateIntLBQs-rg \ --name myTestVM \ --nics myNicTestVM \ --image Win2@19Datacenter \ --admin-username azureuser \ =-no-wait You might need to wait a few minutes for the virtual machine to deploy. Install IIS Use az vm extension set to install IIS on the backend virtual machines and set the default website to the computer name. ‘Azure CLI array=(myVM myVM2) for vm in “${array[@]}" ntips:leam mierosot.comlon-uslazureload-balanceriquickstartoae-balancer-standar-ntemabli soi12524, 7:24 Pmt (ickstar: Create an internal load balancer - Azure CL - Azure Load Balancer | Microsoft Leam do az vm extension set \ --publisher Microsoft.Compute \ s-version 1.8 \ --name CustomScriptextension \ --vm-name $vm \ --resource-group CreateIntLBQS-rg \ --settings '{"commandToExecute":"powershell Add-WindowsFeature Web- Server; powershell Add-Content -Path \"C:\\inetpub\\wwwroot\\Default.htm\" = Value $($env:computername)"}' done Test the load balancer 1.Sign in to the Azure portal. 2. On the Overview page, find the private IP address for the load balancer. In the menu on the left, select All services > All resources > myLoadBalancer. 3. In the overview of myLoadBalancer, copy the address next to Private IP Address. If Private IP address isn't visible, select See more. 4, In the menu on the left, select Alll services > All resources. From the resources list, in the CreatelntLBQS-rg resource group, select myTestVM. 5. On the Overview page, select Connect > Bastion. 6. Enter the username and password that you entered when you created the VM 7. On myTestVM, open Internet Explorer. 8, Enter the IP address from the previous step into the address bar of the browser. The default page of the IIS web server is shown on the browser. ntips:leam microsot.comlen-uslazureload-balanceriquickstartoae-balancer-standar-ntemabli se1125124, 7:34 PM (ickstar: Create an internal load balancer - Azure CL - Azure Load Balancer | Microsoft Leam @ 3 3 s mt Hello World from myVM1 Clean up resources When your resources are no longer needed, use the az group delete command to remove the resource group, load balancer, and all related resources. ‘Azure CLI az group delete \ --name CreateIntLBQs-rg Next steps In this quickstart: * You created an internal load balancer ¢ Attached two virtual machines * Configured the load balancer traffic rule and health probe * Tested the load balancer To learn more about Azure Load Balancer, continue to: [wri cre Londoner? | ntips:leam microsot.comlen-uslazureload-balanceriquickstartoae-balancer-standar-ntemabli aire
You might also like
Az 700t00a Enu Powerpoint 01
PDF
No ratings yet
Az 700t00a Enu Powerpoint 01
65 pages
AZ 700T00A ENU PowerPoint - 04
PDF
No ratings yet
AZ 700T00A ENU PowerPoint - 04
42 pages
Azure Networking PDF
PDF
No ratings yet
Azure Networking PDF
583 pages
Azure Networking
PDF
100% (1)
Azure Networking
452 pages
Create A Gateway Load Balancer Using The Azure CLI
PDF
No ratings yet
Create A Gateway Load Balancer Using The Azure CLI
9 pages
Load Balancing Sur Azure - Fr.en
PDF
No ratings yet
Load Balancing Sur Azure - Fr.en
11 pages
Load Balance VMs Within An Availability Zone by Using The Azure Portal
PDF
No ratings yet
Load Balance VMs Within An Availability Zone by Using The Azure Portal
15 pages
Create A Gateway Load Balancer Using Azure PowerShell
PDF
No ratings yet
Create A Gateway Load Balancer Using Azure PowerShell
9 pages
Az 104t00a Enu Powerpoint 06
PDF
No ratings yet
Az 104t00a Enu Powerpoint 06
33 pages
Azure Load Balancers 1696875706
PDF
No ratings yet
Azure Load Balancers 1696875706
20 pages
Create A Load Balancer With More Than One Availability Set in The Backend Pool Using The Azure Portal
PDF
No ratings yet
Create A Load Balancer With More Than One Availability Set in The Backend Pool Using The Azure Portal
21 pages
Create A Gateway Load Balancer Using The Azure Portal
PDF
No ratings yet
Create A Gateway Load Balancer Using The Azure Portal
16 pages
Virtual Net PDF
PDF
No ratings yet
Virtual Net PDF
590 pages
Steps Overview - Azure - VPC
PDF
No ratings yet
Steps Overview - Azure - VPC
9 pages
Create A Single Virtual Machine Inbound NAT Rule Using The Azure Portal
PDF
No ratings yet
Create A Single Virtual Machine Inbound NAT Rule Using The Azure Portal
13 pages
Lab23 - Understanding Availability set and Load balancer - Azure
PDF
No ratings yet
Lab23 - Understanding Availability set and Load balancer - Azure
164 pages
Az 104t00a Enu Powerpoint 06
PDF
No ratings yet
Az 104t00a Enu Powerpoint 06
37 pages
Azu
PDF
No ratings yet
Azu
9 pages
Vnet Powershell Lab
PDF
No ratings yet
Vnet Powershell Lab
9 pages
AZ 104T00A ENU PowerPoint - 06
PDF
No ratings yet
AZ 104T00A ENU PowerPoint - 06
37 pages
VN PDF
PDF
No ratings yet
VN PDF
848 pages
Vnet Lab
PDF
No ratings yet
Vnet Lab
11 pages
174 - Load-Balancer-lab
PDF
No ratings yet
174 - Load-Balancer-lab
29 pages
AZ 104T00A ENU PowerPoint - 04
PDF
No ratings yet
AZ 104T00A ENU PowerPoint - 04
42 pages
Az 104t00a Enu Powerpoint 04
PDF
No ratings yet
Az 104t00a Enu Powerpoint 04
42 pages
Creating A Virtual Network in Azure Using Azure CLI
PDF
No ratings yet
Creating A Virtual Network in Azure Using Azure CLI
4 pages
Lesson - 05 - Configure and Manage Virtual Networking
PDF
No ratings yet
Lesson - 05 - Configure and Manage Virtual Networking
88 pages
Azure Virtual Network: Technical Requirements
PDF
No ratings yet
Azure Virtual Network: Technical Requirements
16 pages
Azure Load Balancer: Basic Standard
PDF
100% (1)
Azure Load Balancer: Basic Standard
20 pages
Lab7 - Understanding Features of Network Security Group - Azure
PDF
No ratings yet
Lab7 - Understanding Features of Network Security Group - Azure
88 pages
Create A Multiple Virtual Machine Inbound NAT Rule Using The Azure Portal
PDF
No ratings yet
Create A Multiple Virtual Machine Inbound NAT Rule Using The Azure Portal
13 pages
Vnet LAb Guide
PDF
No ratings yet
Vnet LAb Guide
3 pages
1.azure Load Balancer PDF
PDF
No ratings yet
1.azure Load Balancer PDF
4 pages
Lab23 - Understanding Availability set and Load balancer - Azure
PDF
No ratings yet
Lab23 - Understanding Availability set and Load balancer - Azure
163 pages
Azure Portal Terminology
PDF
No ratings yet
Azure Portal Terminology
2 pages
AZ-700_Blueprint
PDF
No ratings yet
AZ-700_Blueprint
1 page
Connecting To Resources Securely in Azure
PDF
No ratings yet
Connecting To Resources Securely in Azure
30 pages
Az 104t00a Enu Powerpoint 04
PDF
No ratings yet
Az 104t00a Enu Powerpoint 04
42 pages
Azure Administer Virtual Networking
PDF
No ratings yet
Azure Administer Virtual Networking
42 pages
Networking Faq
PDF
No ratings yet
Networking Faq
901 pages
Terraform On Azure Cloud v9
PDF
No ratings yet
Terraform On Azure Cloud v9
369 pages
Create An Internal Load Balancer Via Bicep
PDF
No ratings yet
Create An Internal Load Balancer Via Bicep
7 pages
Module-6 Network Taffic Managment
PDF
No ratings yet
Module-6 Network Taffic Managment
35 pages
Lab11 - Understanding FrontEnd and BackEnd Subnets - Azure
PDF
No ratings yet
Lab11 - Understanding FrontEnd and BackEnd Subnets - Azure
95 pages
Azure Networking Lab Guide
PDF
No ratings yet
Azure Networking Lab Guide
9 pages
Az104 Allen Slides
PDF
No ratings yet
Az104 Allen Slides
71 pages
Compute
PDF
No ratings yet
Compute
59 pages
Cloud Computing Presentation
PDF
No ratings yet
Cloud Computing Presentation
17 pages
AZ 104T00A ENU PowerPoint - 04
PDF
No ratings yet
AZ 104T00A ENU PowerPoint - 04
35 pages
AZ 303-304 Notes
PDF
No ratings yet
AZ 303-304 Notes
216 pages
156 - Firewall-Lab
PDF
No ratings yet
156 - Firewall-Lab
34 pages
Azure Bastion
PDF
No ratings yet
Azure Bastion
3 pages
Azure Discovery Day Lab Guide
PDF
No ratings yet
Azure Discovery Day Lab Guide
32 pages
Az 104t00a Enu Powerpoint 04
PDF
No ratings yet
Az 104t00a Enu Powerpoint 04
42 pages
AZ 305T00A ENU PowerPoint - 02
PDF
No ratings yet
AZ 305T00A ENU PowerPoint - 02
37 pages
Build, Deploy and Manage Applications Through The Global Network of Azure Data Centers
PDF
50% (2)
Build, Deploy and Manage Applications Through The Global Network of Azure Data Centers
18 pages
70-534 AzureReady - 22ndApril2016
PDF
No ratings yet
70-534 AzureReady - 22ndApril2016
56 pages
Az 305t00a Enu Powerpoint 02
PDF
No ratings yet
Az 305t00a Enu Powerpoint 02
35 pages
Virtual Network1233211412001
PDF
No ratings yet
Virtual Network1233211412001
3 pages
Configure Outbound Connectivity With A Gateway Load Balancer
PDF
No ratings yet
Configure Outbound Connectivity With A Gateway Load Balancer
7 pages
Azure Blob Storage Client Library For C++
PDF
No ratings yet
Azure Blob Storage Client Library For C++
11 pages
Azure Blob Storage Client Library For Java
PDF
No ratings yet
Azure Blob Storage Client Library For Java
16 pages
Migrate From Inbound NAT Pools To NAT Rules
PDF
No ratings yet
Migrate From Inbound NAT Pools To NAT Rules
4 pages
Recover Deleted Storage Account
PDF
No ratings yet
Recover Deleted Storage Account
3 pages
Introduction To Azure Blob Storage
PDF
No ratings yet
Introduction To Azure Blob Storage
6 pages
Azure Blob Storage Client Library For Python
PDF
No ratings yet
Azure Blob Storage Client Library For Python
13 pages
Create, Download, and List Blobs With Azure CLI
PDF
No ratings yet
Create, Download, and List Blobs With Azure CLI
6 pages
What Is Azure Blob Storage
PDF
No ratings yet
What Is Azure Blob Storage
2 pages
DNS Name Resolution
PDF
No ratings yet
DNS Name Resolution
7 pages
Azure DDoS Network Protection
PDF
No ratings yet
Azure DDoS Network Protection
9 pages
Use Azure Storage Explorer To Create A Blob
PDF
No ratings yet
Use Azure Storage Explorer To Create A Blob
8 pages
Blob Storage Feature Support in Azure Storage Accounts
PDF
No ratings yet
Blob Storage Feature Support in Azure Storage Accounts
6 pages
Zero Trust Principles To An Azure Virtual WAN
PDF
No ratings yet
Zero Trust Principles To An Azure Virtual WAN
17 pages
Integrate With Zero Trust Solutions
PDF
No ratings yet
Integrate With Zero Trust Solutions
1 page
Identity Integrations
PDF
No ratings yet
Identity Integrations
7 pages
Virtual Machine With A Static Public IP Address
PDF
No ratings yet
Virtual Machine With A Static Public IP Address
4 pages
Azure Linux VM Portal LAB
PDF
No ratings yet
Azure Linux VM Portal LAB
7 pages
Create A Fully Qualified Domain Name For A VM
PDF
No ratings yet
Create A Fully Qualified Domain Name For A VM
1 page
Azure Win VM Terraform LAB
PDF
No ratings yet
Azure Win VM Terraform LAB
10 pages
Azure Win VM Portal LAB
PDF
No ratings yet
Azure Win VM Portal LAB
8 pages
Azure VM Overview
PDF
No ratings yet
Azure VM Overview
9 pages