Azure Virtual Networks (VNets)
Azure Virtual Network (VNet) is the fundamental building block for your private network in Azure. VNet enables you to create your own private space in the Azure cloud that is isolated from other virtual networks in Azure. You can then use it to launch Azure resources, such as Azure Virtual Machines (VMs), enabling them to securely communicate with each other, the internet, and on-premises networks.
Key Concepts
- Isolation: VNets provide a secure and isolated network environment within Azure.
- Address Space: Each VNet is assigned a private IP address space. You can define this space using public or private IP address ranges.
- Subnets: VNets can be segmented into subnets, each with its own IP address range. This allows for granular control over network traffic and resource placement.
- Connectivity: VNets enable connectivity between Azure resources, to the internet, and to on-premises networks through various methods like VPN Gateways and ExpressRoute.
- Security: VNets integrate with Azure's security services like Network Security Groups (NSGs) and Azure Firewall for robust protection.
Creating a Virtual Network
You can create an Azure Virtual Network using the Azure portal, Azure CLI, Azure PowerShell, or ARM templates.
Using the Azure Portal:
- Navigate to the Azure portal.
- Search for "Virtual networks" and select it.
- Click "Create".
- Fill in the required details, including subscription, resource group, VNet name, and address space.
- Define initial subnets if needed.
- Review and create the VNet.
Using Azure CLI:
az network vnet create \
--resource-group MyResourceGroup \
--name MyVNet \
--address-prefixes 10.0.0.0/16 \
--location eastus
Virtual Network Peering
Virtual network peering connects two Azure VNets together. Once peered, networks that have a peering relationship can communicate with each other as if they were one network. Traffic between peered VNets is routed through the Azure backbone infrastructure, not over the public internet.
Benefits of Peering:
- Low-latency, high-bandwidth connection between VNets.
- No need for a VPN gateway or ExpressRoute circuit for inter-VNet communication within the same region.
- Seamless transitive connectivity is not supported.
Subnets
A subnet is a range of IP addresses within a VNet. After you create a VNet, you can divide it into subnets. Each subnet within a VNet can contain Azure resources. Dividing your network into subnets is a good practice for security and network management.
Creating a Subnet:
Subnets are created within an existing VNet. You can define them during VNet creation or add them later.
az network vnet subnet create \
--resource-group MyResourceGroup \
--vnet-name MyVNet \
--name MySubnet \
--address-prefixes 10.0.1.0/24
Next Steps
Explore the following topics to deepen your understanding of Azure networking: