az network vnet

Manage Azure Virtual Networks.

Commands

az network vnet check-ip-address Check if a private IP address is available for use.
az network vnet create Create a virtual network.
az network vnet delete Delete a virtual network.
az network vnet list List virtual networks.
az network vnet list-endpoint-services List what values of endpoint services are available for use.
az network vnet peering Manage peering connections between Azure Virtual Networks.
az network vnet peering create Create a peering.
az network vnet peering delete Delete a peering.
az network vnet peering list List peerings.
az network vnet peering show Show details of a peering.
az network vnet peering update Update a peering.
az network vnet show Get the details of a virtual network.
az network vnet subnet Manage subnets in an Azure Virtual Network.
az network vnet subnet create Create a subnet and associate an existing NSG and route table.
az network vnet subnet delete Delete a subnet.
az network vnet subnet list List subnets.
az network vnet subnet show Show details of a subnet.
az network vnet subnet update Update a subnet.
az network vnet update Update a virtual network.

az network vnet check-ip-address

Check if a private IP address is available for use.

az network vnet check-ip-address --name
--resource-group
[--ip-address]

Required Parameters

--name -n

The virtual network (VNet) name.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Optional Parameters

--ip-address

The private IP address to be verified.

az network vnet create

Create a virtual network.

You may also create a subnet at the same time by specifying a subnet name and (optionally) an address prefix.

az network vnet create --name
--resource-group
[--address-prefixes]
[--ddos-protection {false, true}]
[--dns-servers]
[--location]
[--subnet-name]
[--subnet-prefix]
[--tags]
[--vm-protection {false, true}]

Examples

Create a basic virtual network.

az network vnet create -g MyResourceGroup -n MyVnet

Create a virtual network with a specific address prefix and one subnet.

az network vnet create -g MyResourceGroup -n MyVnet --address-prefix 10.0.0.0/16 --subnet-name MySubnet --subnet-prefix 10.0.0.0/24

Required Parameters

--name -n

The virtual network (VNet) name.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Optional Parameters

--address-prefixes

Space separated list of IP address prefixes for the VNet.

default value: 10.0.0.0/16
--ddos-protection

Enable DDoS protection for protected resources in the VNet.

accepted values: false, true
--dns-servers

Space separated list of DNS server IP addresses.

--location -l

Location. You can configure the default location using az configure --defaults location=<location>.

--subnet-name

Name of a new subnet to create within the VNet.

--subnet-prefix

IP address prefix for the new subnet. If omitted, automatically reserves a /24 (or as large as available) block within the VNet address space.

--tags

Space separated tags in 'key[=value]' format. Use "" to clear existing tags.

--vm-protection

Enable VM protection for all subnets in the VNet.

accepted values: false, true

az network vnet delete

Delete a virtual network.

az network vnet delete --name
--resource-group

Required Parameters

--name -n

The virtual network (VNet) name.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

az network vnet list

List virtual networks.

az network vnet list [--resource-group]

Examples

List virtual networks which specify a certain address prefix.

az network vnet list --query "[?contains(addressSpace.addressPrefixes, '10.0.0.0/16')]"

Optional Parameters

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

az network vnet list-endpoint-services

List what values of endpoint services are available for use.

az network vnet list-endpoint-services --location

Required Parameters

--location -l

Location. You can configure the default location using az configure --defaults location=<location>.

az network vnet show

Get the details of a virtual network.

az network vnet show --name
--resource-group
[--expand]

Required Parameters

--name -n

The virtual network (VNet) name.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Optional Parameters

--expand

Expands referenced resources.

az network vnet update

Update a virtual network.

az network vnet update --name
--resource-group
[--add]
[--address-prefixes]
[--ddos-protection {false, true}]
[--dns-servers]
[--remove]
[--set]
[--vm-protection {false, true}]

Required Parameters

--name -n

The virtual network (VNet) name.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Optional Parameters

--add

Add an object to a list of objects by specifying a path and key value pairs. Example: --add property.listProperty <key=value, string or JSON string>.

--address-prefixes

Space separated list of IP address prefixes for the VNet.

--ddos-protection

Enable DDoS protection for protected resources in the VNet.

accepted values: false, true
--dns-servers

Space separated list of DNS server IP addresses.

--remove

Remove a property or an element from a list. Example: --remove property.list OR --remove propertyToRemove.

--set

Update an object by specifying a property path and value to set. Example: --set property1.property2=.

--vm-protection

Enable VM protection for all subnets in the VNet.

accepted values: false, true