az network vnet subnet

Manage subnets in an Azure Virtual Network.

Commands

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 subnet create

Create a subnet and associate an existing NSG and route table.

az network vnet subnet create --address-prefix
--name
--resource-group
--vnet-name
[--network-security-group]
[--route-table]
[--service-endpoints]

Examples

Create new subnet attached to an NSG with a custom route table.

az network vnet subnet create -g MyResourceGroup --vnet-name MyVnet -n MySubnet     --address-prefix 10.0.0.0/24 --network-security-group MyNsg --route-table MyRouteTable

Required Parameters

--address-prefix
The address prefix in CIDR format.
--name -n
The subnet name.
--resource-group -g
Name of resource group. You can configure the default group using `az configure --defaults group=<name>`.
--vnet-name
The virtual network (VNet) name.

Optional Parameters

--network-security-group
Name or ID of network security group to associate with the subnet.
--route-table
Name or ID of a route table to associate with the subnet.
--service-endpoints
Space separated list of services allowed private access to this subnet.
value from: az network vnet list-endpoint-services

az network vnet subnet delete

Delete a subnet.

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

Required Parameters

--name -n
The subnet name.
--resource-group -g
Name of resource group. You can configure the default group using `az configure --defaults group=<name>`.
--vnet-name
The virtual network (VNet) name.

az network vnet subnet list

List subnets.

az network vnet subnet list --resource-group
--vnet-name

Required Parameters

--resource-group -g
Name of resource group. You can configure the default group using `az configure --defaults group=<name>`.
--vnet-name
The virtual network (VNet) name.

az network vnet subnet show

Show details of a subnet.

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

Required Parameters

--name -n
The subnet name.
--resource-group -g
Name of resource group. You can configure the default group using `az configure --defaults group=<name>`.
--vnet-name
The virtual network (VNet) name.

Optional Parameters

--expand
Expands referenced resources.

az network vnet subnet update

Update a subnet.

az network vnet subnet update --name
--resource-group
--vnet-name
[--add]
[--address-prefix]
[--network-security-group]
[--remove]
[--route-table]
[--service-endpoints]
[--set]

Required Parameters

--name -n
The subnet name.
--resource-group -g
Name of resource group. You can configure the default group using `az configure --defaults group=<name>`.
--vnet-name
The virtual network (VNet) name.

Optional Parameters

--add
Add an object to a list of objects by specifying a path and key value pairs. Example: --add property.listProperty .
--address-prefix
The address prefix in CIDR format.
--network-security-group
Attach with existing network security group, both name or id are accepted. Use empty string "" to detach it.
--remove
Remove a property or an element from a list. Example: --remove property.list OR --remove propertyToRemove.
--route-table
Name or ID of a route table to associate with the subnet.
--service-endpoints
Space separated list of services allowed private access to this subnet.
value from: az network vnet list-endpoint-services
--set
Update an object by specifying a property path and value to set. Example: --set property1.property2=.