Skip to content

Commit 460b144

Browse files
authored
Merge pull request #208330 from mumian/0817-bicep-lb
[Azure public load balance] - create Bicep quickstart
2 parents 2cc61cc + 8a05a6f commit 460b144

File tree

2 files changed

+137
-6
lines changed

2 files changed

+137
-6
lines changed

articles/load-balancer/TOC.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,15 @@
88
items:
99
- name: Create a public load balancer
1010
items:
11-
- name: Portal
11+
- name: Portal
1212
href: quickstart-load-balancer-standard-public-portal.md
1313
- name: PowerShell
1414
href: quickstart-load-balancer-standard-public-powershell.md
1515
- name: CLI
1616
href: quickstart-load-balancer-standard-public-cli.md
17+
- name: Bicep
18+
displayName: Resource Manager,ARM,template
19+
href: quickstart-load-balancer-standard-public-bicep.md
1720
- name: ARM template
1821
displayName: Resource Manager
1922
href: quickstart-load-balancer-standard-public-template.md
@@ -222,7 +225,7 @@
222225
- name: IPv6
223226
items:
224227
- name: Public Load Balancer
225-
items:
228+
items:
226229
- name: Standard Public Load Balancer with IPv6 - PowerShell
227230
href: virtual-network-ipv4-ipv6-dual-stack-standard-load-balancer-powershell.md
228231
- name: Standard Public Load Balancer with IPv6 - Azure CLI
@@ -233,20 +236,20 @@
233236
items:
234237
- name: Standard Internal Load Balancer with IPv6 - PowerShell
235238
href: ipv6-dual-stack-standard-internal-load-balancer-powershell.md
236-
- name: Add IPv6 to existing deployments
239+
- name: Add IPv6 to existing deployments
237240
items:
238241
- name: Add IPv6 to an IPv4 application- PowerShell
239242
href: ipv6-add-to-existing-vnet-powershell.md
240243
- name: Add IPv6 to an IPv4 application - Azure CLI
241-
href: ipv6-add-to-existing-vnet-cli.md
244+
href: ipv6-add-to-existing-vnet-cli.md
242245
- name: Troubleshoot
243246
items:
244247
- name: Troubleshoot Azure Load Balancer
245248
href: load-balancer-troubleshoot.md
246249
- name: Health Probe status
247-
href: load-balancer-troubleshoot-health-probe-status.md
250+
href: load-balancer-troubleshoot-health-probe-status.md
248251
- name: Backend pool (VM) traffic
249-
href: load-balancer-troubleshoot-backend-traffic.md
252+
href: load-balancer-troubleshoot-backend-traffic.md
250253
- name: Troubleshoot SNAT exhaustion and connection timeouts
251254
href: troubleshoot-outbound-connection.md
252255
- name: Resource health and inbound availability issues
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
---
2+
title: "Quickstart: Create a public load balancer - Bicep"
3+
titleSuffix: Azure Load Balancer
4+
description: This quickstart shows how to create a load balancer by using a Bicep file.
5+
services: load-balancer
6+
documentationcenter: na
7+
author: mumian
8+
ms.service: load-balancer
9+
ms.topic: quickstart
10+
ms.tgt_pltfrm: na
11+
ms.workload: infrastructure-services
12+
ms.date: 08/17/2022
13+
ms.author: jgao
14+
ms.custom: mvc, subject-bicepqs, mode-arm
15+
#Customer intent: I want to create a load balancer by using a Bicep file so that I can load balance internet traffic to VMs.
16+
---
17+
18+
# Quickstart: Create a public load balancer to load balance VMs by using a Bicep file
19+
20+
Load balancing provides a higher level of availability and scale by spreading incoming requests across multiple virtual machines (VMs).
21+
22+
This quickstart shows you how to deploy a standard load balancer to load balance virtual machines.
23+
24+
Using a Bicep file takes fewer steps comparing to other deployment methods.
25+
26+
[!INCLUDE [About Bicep](../../includes/resource-manager-quickstart-bicep-introduction.md)]
27+
28+
## Prerequisites
29+
30+
If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin.
31+
32+
## Review the Bicep file
33+
34+
The Bicep file used in this quickstart is from [Azure Quickstart Templates](https://azure.microsoft.com/resources/templates/load-balancer-standard-create/).
35+
36+
Load balancer and public IP SKUs must match. When you create a standard load balancer, you must also create a new standard public IP address that is configured as the frontend for the standard load balancer. If you want to create a basic load balancer, use [this template](https://azure.microsoft.com/resources/templates/2-vms-loadbalancer-natrules/). Microsoft recommends using standard SKU for production workloads.
37+
38+
:::code language="bicep" source="~/quickstart-templates/quickstarts/microsoft.network/load-balancer-standard-create/main.bicep":::
39+
40+
Multiple Azure resources have been defined in the bicep file:
41+
42+
- [**Microsoft.Network/loadBalancers**](/azure/templates/microsoft.network/loadbalancers)
43+
- [**Microsoft.Network/publicIPAddresses**](/azure/templates/microsoft.network/publicipaddresses): for the load balancer, bastion host, and for each of the three virtual machines.
44+
- [**Microsoft.Network/bastionHosts**](/azure/templates/microsoft.network/bastionhosts)
45+
- [**Microsoft.Network/networkSecurityGroups**](/azure/templates/microsoft.network/networksecuritygroups)
46+
- [**Microsoft.Network/virtualNetworks**](/azure/templates/microsoft.network/virtualnetworks)
47+
- [**Microsoft.Compute/virtualMachines**](/azure/templates/microsoft.compute/virtualmachines) (3).
48+
- [**Microsoft.Network/networkInterfaces**](/azure/templates/microsoft.network/networkinterfaces) (3).
49+
- [**Microsoft.Compute/virtualMachine/extensions**](/azure/templates/microsoft.compute/virtualmachines/extensions) (3): use to configure the Internet Information Server (IIS), and the web pages.
50+
51+
To find more Bicep files or ARM templates that are related to Azure Load Balancer, see [Azure Quickstart Templates](https://azure.microsoft.com/resources/templates/?resourceType=Microsoft.Network&pageNumber=1&sort=Popular).
52+
53+
## Deploy the Bicep file
54+
55+
1. Save the Bicep file as **main.bicep** to your local computer.
56+
1. Deploy the Bicep file using either Azure CLI or Azure PowerShell.
57+
58+
# [CLI](#tab/CLI)
59+
60+
```azurecli
61+
az group create --name exampleRG --location centralus
62+
az deployment group create --resource-group exampleRG --template-file main.bicep
63+
```
64+
65+
# [PowerShell](#tab/PowerShell)
66+
67+
```azurepowershell
68+
New-AzResourceGroup -Name exampleRG -Location centralus
69+
New-AzResourceGroupDeployment -ResourceGroupName exampleRG -TemplateFile ./main.bicep
70+
```
71+
72+
---
73+
74+
> [!NOTE]
75+
> The Bicep file deployment creates three availability zones. Availability zones are supported only in [certain regions](../availability-zones/az-overview.md). Use one of the supported regions. If you aren't sure, enter **centralus**.
76+
77+
You will be prompted to enter the following values:
78+
79+
- **projectName**: used for generating resource names.
80+
- **adminUsername**: virtual machine administrator username.
81+
- **adminPassword**: virtual machine administrator password.
82+
83+
It takes about 10 minutes to deploy the Bicep file.
84+
85+
## Review deployed resources
86+
87+
1. Sign in to the [Azure portal](https://portal.azure.com).
88+
89+
1. Select **Resource groups** from the left pane.
90+
91+
1. Select the resource group that you created in the previous section. The default resource group name is **exampleRG**.
92+
93+
1. Select the load balancer. Its default name is the project name with **-lb** appended.
94+
95+
1. Copy only the IP address part of the public IP address, and then paste it into the address bar of your browser.
96+
97+
:::image type="content" source="./media/quickstart-load-balancer-standard-public-template/azure-standard-load-balancer-resource-manager-template-deployment-public-ip.png" alt-text="Screenshot of Azure standard load balancer Resource Manager template public IP.":::
98+
99+
The browser displays the default page of the Internet Information Services (IIS) web server.
100+
101+
:::image type="content" source="./media/quickstart-load-balancer-standard-public-template/load-balancer-test-web-page.png" alt-text="Screenshot of IIS web server.":::
102+
103+
To see the load balancer distribute traffic across all three VMs, you can force a refresh of your web browser from the client machine.
104+
105+
## Clean up resources
106+
107+
When you no longer need them, delete the:
108+
109+
- Resource group
110+
- Load balancer
111+
- Related resources
112+
113+
Go to the Azure portal, select the resource group that contains the load balancer, and then select **Delete resource group**.
114+
115+
## Next steps
116+
117+
In this quickstart, you:
118+
119+
- Created a virtual network for the load balancer and virtual machines.
120+
- Created an Azure Bastion host for management.
121+
- Created a standard load balancer and attached VMs to it.
122+
- Configured the load-balancer traffic rule, and the health probe.
123+
- Tested the load balancer.
124+
125+
To learn more, continue to the tutorials for Azure Load Balancer.
126+
127+
> [!div class="nextstepaction"]
128+
> [Azure Load Balancer tutorials](./quickstart-load-balancer-standard-public-portal.md)

0 commit comments

Comments
 (0)