title | titleSuffix | description | services | author | ms.service | ms.topic | ms.date | ms.author | ms.custom |
---|---|---|---|---|---|---|---|---|---|
Quickstart: Use a Resource Manager template to create a virtual network |
Azure Virtual Network |
Learn how to use an Azure Resource Manager template to create an Azure virtual network. |
virtual-network |
asudbring |
virtual-network |
quickstart |
05/29/2024 |
allensu |
mode-arm, FY23 content-maintenance, devx-track-arm-template |
In this quickstart, you learn how to create a virtual network with two subnets by using an Azure Resource Manager template. A virtual network is the fundamental building block for your private network in Azure. It enables Azure resources, like virtual machines (VMs), to securely communicate with each other and with the internet.
:::image type="content" source="./media/quick-create-bicep/virtual-network-bicep-resources.png" alt-text="Diagram of resources created in the virtual network quickstart." lightbox="./media/quick-create-bicep/virtual-network-bicep-resources.png":::
[!INCLUDE About Azure Resource Manager]
You can also complete this quickstart by using the Azure portal, Azure PowerShell, or the Azure CLI.
If you don't have an Azure subscription, create a free account before you begin.
The template that you use in this quickstart is from Azure Quickstart Templates.
:::code language="json" source="~/quickstart-templates/quickstarts/microsoft.network/vnet-two-subnets/azuredeploy.json" :::
The template defines the following Azure resources:
- Microsoft.Network/virtualNetworks: Create a virtual network.
- Microsoft.Network/virtualNetworks/subnets: Create a subnet.
Deploy the Resource Manager template to Azure:
-
Select Deploy to Azure to sign in to Azure and open the template. The template creates a virtual network with two subnets.
:::image type="content" source="~/reusable-content/ce-skilling/azure/media/template-deployments/deploy-to-azure-button.svg" alt-text="Button to deploy the Resource Manager template to Azure." border="false" link="https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2Fquickstarts%2Fmicrosoft.network%2Fvnet-two-subnets%2Fazuredeploy.json":::
-
In the portal, on the Create a Virtual Network with two Subnets page, enter or select the following values:
- Resource group: Select Create new, enter CreateVNetQS-rg for the resource group name, and then select OK.
- Virtual Network Name: Enter a name for the new virtual network.
-
Select Review + create, and then select Create.
-
When deployment finishes, select the Go to resource button to review the resources that you deployed.
Explore the resources that you created with the virtual network by browsing through the settings panes for VNet1:
-
The Overview tab shows the defined address space of 10.0.0.0/16.
-
The Subnets tab shows the deployed subnets of Subnet1 and Subnet2 with the appropriate values from the template.
To learn about the JSON syntax and properties for a virtual network in a template, see Microsoft.Network/virtualNetworks.
When you no longer need the resources that you created with the virtual network, delete the resource group. This action removes the virtual network and all the related resources.
To delete the resource group, call the Remove-AzResourceGroup
cmdlet:
Remove-AzResourceGroup -Name <your resource group name>
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:
[!div class="nextstepaction"] Filter network traffic