How to create VNet with Subnet using Azure CLI

An Azure Virtual Network (VNet) is a representation of your own network in the cloud. It is a logical isolation of the Azure cloud dedicated to your subscription.Each VNet you create has its own CIDR block and can be linked to other VNets and on-premises networks.

Following Azure CLI command creates a VNet named test-vnet with CIDR block 10.0.0.0/16 and a subnet named mySubnet with CIDR block 10.0.0.0/24.

        

az network vnet create \
    --resource-group myResourceGroup \
    --name test-vnet \
    --address-prefixes 10.0.0.0/16 \
    --subnet-name mySubnet \
    --subnet-prefixes 10.0.0.0/24