Skip to content

Commit edc1356

Browse files
authored
Merge pull request #201607 from schaffererin/virtual-network-bicep-quickstart
Creating new Bicep quickstart - Virtual Network
2 parents 2bb9bfc + ba5b9ee commit edc1356

File tree

3 files changed

+108
-0
lines changed

3 files changed

+108
-0
lines changed

articles/azure-resource-manager/bicep/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@
155155
href: ../../private-link/create-private-link-service-bicep.md?toc=/azure/azure-resource-manager/bicep/toc.json
156156
- name: Traffic Manager
157157
href: ../../traffic-manager/quickstart-create-traffic-manager-profile-bicep.md?toc=/azure/azure-resource-manager/bicep/toc.json
158+
- name: Virtual Network
159+
href: ../../virtual-network/quick-create-bicep.md?=toc=/azure/azure-resource-manager/bicep/toc.json
158160
- name: Web Application Firewall
159161
href: ../../web-application-firewall/ag/quick-create-bicep.md?toc=/azure/azure-resource-manager/bicep/toc.json
160162
- name: Security
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
---
2+
title: 'Quickstart: Create a virtual network using Bicep'
3+
titleSuffix: Azure Virtual Network
4+
description: Learn how to use Bicep to create an Azure virtual network.
5+
services: virtual-network
6+
author: schaffererin
7+
ms.service: virtual-network
8+
ms.topic: quickstart
9+
ms.date: 06/24/2022
10+
ms.author: v-eschaffer
11+
ms.custom: devx-track-azurepowershell, mode-arm
12+
---
13+
14+
# Quickstart: Create a virtual network - Bicep
15+
16+
In this quickstart, you learn how to create a virtual network with two subnets using Bicep. A virtual network is the fundamental building block for your private network in Azure. It enables Azure resources, like VMs, to securely communicate with each other and with the internet.
17+
18+
[!INCLUDE [About Bicep](../../includes/resource-manager-quickstart-bicep-introduction.md)]
19+
20+
## Prerequisites
21+
22+
If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin.
23+
24+
## Review the Bicep file
25+
26+
The Bicep file used in this quickstart is from [Azure Quickstart Templates](https://github.com/Azure/azure-quickstart-templates/blob/master/quickstarts/microsoft.network/vnet-two-subnets)
27+
28+
:::code language="bicep" source="~/quickstart-templates/quickstarts/microsoft.network/vnet-two-subnets/main.bicep" :::
29+
30+
The following Azure resources have been defined in the Bicep file:
31+
32+
- [**Microsoft.Network/virtualNetworks**](/azure/templates/microsoft.network/virtualnetworks): Create an Azure virtual network.
33+
- [**Microsoft.Network/virtualNetworks/subnets**](/azure/templates/microsoft.network/virtualnetworks/subnets): Create a subnet.
34+
35+
## Deploy the Bicep file
36+
37+
1. Save the Bicep file as **main.bicep** to your local computer.
38+
1. Deploy the Bicep file using either Azure CLI or Azure PowerShell.
39+
40+
# [CLI](#tab/CLI)
41+
42+
```azurecli
43+
az group create --name exampleRG --location eastus
44+
az deployment group create --resource-group exampleRG --template-file main.bicep
45+
```
46+
47+
# [PowerShell](#tab/PowerShell)
48+
49+
```azurepowershell
50+
New-AzResourceGroup -Name exampleRG -Location eastus
51+
New-AzResourceGroupDeployment -ResourceGroupName exampleRG -TemplateFile ./main.bicep
52+
```
53+
54+
---
55+
56+
When the deployment finishes, you should see a message indicating the deployment succeeded.
57+
58+
## Review deployed resources
59+
60+
Use Azure CLI or Azure PowerShell to review the deployed resources.
61+
62+
# [CLI](#tab/CLI)
63+
64+
```azurecli-interactive
65+
az resource list --resource-group exampleRG
66+
```
67+
68+
# [PowerShell](#tab/PowerShell)
69+
70+
```azurepowershell-interactive
71+
Get-AzResource -ResourceGroupName exampleRG
72+
```
73+
74+
---
75+
76+
You can use the Azure portal to explore the resources by browsing the settings blades for **VNet1**.
77+
78+
1. On the **Overview** tab, you will see the defined address space of **10.0.0.0/16**.
79+
2. On the **Subnets** tab, you will see the deployed subnets of **Subnet1** and **Subnet2** with the appropriate values from the Bicep file.
80+
81+
## Clean up resources
82+
83+
When you no longer need the resources that you created with the virtual network, use Azure portal, Azure CLI, or Azure PowerShell to delete the resource group. This removes the virtual network and all the related resources.
84+
85+
# [CLI](#tab/CLI)
86+
87+
```azurecli-interactive
88+
az group delete --name exampleRG
89+
```
90+
91+
# [PowerShell](#tab/PowerShell)
92+
93+
```azurepowershell-interactive
94+
Remove-AzResourceGroup -Name exampleRG
95+
```
96+
97+
---
98+
99+
## Next steps
100+
101+
In this quickstart, you deployed an Azure virtual network with two subnets. To learn more about Azure virtual networks, continue to the tutorial for virtual networks.
102+
103+
> [!div class="nextstepaction"]
104+
> [Filter network traffic](tutorial-filter-network-traffic.md)

articles/virtual-network/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
href: quick-create-powershell.md
1313
- name: Create virtual network - Azure CLI
1414
href: quick-create-cli.md
15+
- name: Create virtual network - Bicep
16+
href: quick-create-bicep.md
1517
- name: Create virtual network - ARM template
1618
href: quick-create-template.md
1719
expanded: true

0 commit comments

Comments
 (0)