az network vnet

Manage Azure virtual networks.

Commands

Name Description Type Status
az network vnet create

Create a virtual network.

Core Preview
az network vnet delete

Delete a virtual network.

Core Preview
az network vnet list

List virtual networks.

Core Preview
az network vnet show

Show details for a virtual network.

Core Preview
az network vnet subnet

Manage subnets in an Azure virtual network.

Core Preview
az network vnet subnet create

Create or update a subnet.

Core Preview
az network vnet subnet delete

Delete a subnet.

Core Preview
az network vnet subnet list

List subnets in a virtual network.

Core Preview
az network vnet subnet show

Show a subnet.

Core Preview

az network vnet create

Preview

Create a virtual network.

Provision an Azure virtual network in the specified resource group. Supply the VNet address space with --address-prefixes; when omitted it defaults to 10.0.0.0/16 unless --ipam-allocations is used. Subnets can be declared either with the compound --subnets argument (repeat it once per subnet, passing KEY=VALUE tokens) or with the positional --subnet-names / --subnet-address-prefixes pair, which are matched positionally: the first prefix list belongs to the first subnet name, and so on.

az network vnet create --location
                       --name
                       --resource-group
                       [--address-prefixes]
                       [--bgp-community]
                       [--ddos-protection]
                       [--ddos-protection-plan]
                       [--dns-servers]
                       [--enable-encryption]
                       [--encryption-policy {DropUnencrypted, AllowUnencrypted}]
                       [--extended-location]
                       [--flowtimeout]
                       [--ip-allocations]
                       [--ipam-allocations]
                       [--pe-vnet-policies {Disabled, Basic}]
                       [--profile]
                       [--sgp]
                       [--subnet-address-prefixes]
                       [--subnet-names]
                       [--subnets]
                       [--subscription-id]
                       [--tags]
                       [--vm-protection]

Examples

Create a virtual network with a single subnet

az network vnet create --name myvnet --resource-group myrg --location eastus --address-prefixes 10.0.0.0/16 --subnet-names default --subnet-address-prefixes 10.0.0.0/24

Create a virtual network without subnets

az network vnet create --name myvnet --resource-group myrg --location eastus --address-prefixes 10.0.0.0/16

Create several subnets with per-subnet settings

az network vnet create --name myvnet --resource-group myrg --location eastus --address-prefixes 10.0.0.0/16 \
  --subnets name=web address-prefixes=10.0.1.0/24 default-outbound-access=false \
  --subnets name=data address-prefixes=10.0.2.0/24 service-endpoints=Microsoft.Storage,Microsoft.Sql

Delegate a subnet to a service

az network vnet create --name myvnet --resource-group myrg --location eastus --address-prefixes 10.0.0.0/16 \
  --subnets name=apps address-prefixes=10.0.3.0/24 delegations=Microsoft.Web/serverFarms

Set DNS servers, tags, and a flow timeout

az network vnet create --name myvnet --resource-group myrg --location eastus --address-prefixes 10.0.0.0/16 \
  --dns-servers 10.0.0.4 10.0.0.5 --tags owner=team-a env=prod --flowtimeout 10

Enable virtual network encryption

az network vnet create --name myvnet --resource-group myrg --location eastus --address-prefixes 10.0.0.0/16 \
  --enable-encryption --encryption-policy AllowUnencrypted

Required Parameters

--location -l

Location for the virtual network.

--name -n

The name of the virtual network.

--resource-group -g

The resource group name.

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--address-prefixes

Address prefixes for the virtual network, e.g. 10.0.0.0/16. Defaults to 10.0.0.0/16 unless IPAM pool allocations are supplied.

--bgp-community

The BGP community associated with the virtual network.

--ddos-protection

Enable DDoS protection for the virtual network.

--ddos-protection-plan

Resource id of the DDoS protection plan to associate.

--dns-servers

DNS server IP addresses for the virtual network.

--enable-encryption

Enable virtual network encryption.

--encryption-policy

Behaviour when a VM without encryption joins an encrypted virtual network.

Property Value
Accepted values: DropUnencrypted, AllowUnencrypted
--extended-location

Name of the edge zone (extended location) to create the virtual network in.

--flowtimeout

Flow timeout in minutes for the virtual network, between 4 and 30.

--ip-allocations

Resource ids of the IP allocations to reference.

--ipam-allocations

Resource ids of the IPAM pools to allocate address prefixes from.

--pe-vnet-policies

Private endpoint VNet policies.

Property Value
Accepted values: Disabled, Basic
--profile

Use the named profile for this command (overrides the active profile).

--sgp

Summarized gateway prefixes advertised for the virtual network.

--subnet-address-prefixes

Address prefixes for each subnet, positionally matched to the subnet names.

--subnet-names

Names of the subnets to create. Simple alternative to the compound subnet argument.

--subnets

Subnets to create, one occurrence per subnet, each a space-separated list of KEY=VALUE pairs. Supported keys: name, address-prefix, address-prefixes, nsg, route-table, nat-gateway, default-outbound-access, service-endpoints, service-endpoint-policy, delegations, ipam-pool-prefix-allocations, disable-private-endpoint-network-policies, disable-private-link-service-network-policies. Multi-valued keys take a comma-separated value.

--subscription-id

Azure Subscription Id. Defaults to the active profile's subscription.

--tags

Resource tags in KEY[=VALUE] form (space-separated); a bare KEY sets an empty value and a repeated KEY keeps its last value.

--vm-protection

Enable VM protection for every subnet in the virtual network.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h -help -? --?

Show help for the command or group and exit.

--no-cache

Bypass the extension discovery cache and reload extensions from disk.

--output -o

Output format.

Property Value
Default value: json
Accepted values: json, jsonc, table, tsv, yaml, yamlc
--query

JMESPath query string to filter/project the command result before rendering.

az network vnet delete

Preview

Delete a virtual network.

Remove the specified virtual network from its resource group. The delete fails while the virtual network is still in use — detach or delete dependent resources such as network interfaces, private endpoints, and gateways first.

az network vnet delete --name
                       --resource-group
                       [--profile]
                       [--subscription-id]

Examples

Delete a virtual network

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

Delete using shell variables

az network vnet delete --name $vnetName --resource-group $rg --subscription-id $subId

Required Parameters

--name -n

The name of the virtual network.

--resource-group -g

The resource group name.

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--profile

Use the named profile for this command (overrides the active profile).

--subscription-id

Azure Subscription Id. Defaults to the active profile's subscription.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h -help -? --?

Show help for the command or group and exit.

--no-cache

Bypass the extension discovery cache and reload extensions from disk.

--output -o

Output format.

Property Value
Default value: json
Accepted values: json, jsonc, table, tsv, yaml, yamlc
--query

JMESPath query string to filter/project the command result before rendering.

az network vnet list

Preview

List virtual networks.

List virtual networks in a resource group, or across the whole subscription when --resource-group is omitted. Results are paginated transparently: every page is followed and the combined set is returned as a single array.

az network vnet list [--profile]
                     [--resource-group]
                     [--subscription-id]

Examples

List virtual networks in a resource group

az network vnet list --resource-group myrg

List every virtual network in the subscription

az network vnet list --subscription-id 00000000-0000-0000-0000-000000000000

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--profile

Use the named profile for this command (overrides the active profile).

--resource-group -g

The resource group name. Omit to list every virtual network in the subscription.

--subscription-id

Azure Subscription Id. Defaults to the active profile's subscription.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h -help -? --?

Show help for the command or group and exit.

--no-cache

Bypass the extension discovery cache and reload extensions from disk.

--output -o

Output format.

Property Value
Default value: json
Accepted values: json, jsonc, table, tsv, yaml, yamlc
--query

JMESPath query string to filter/project the command result before rendering.

az network vnet show

Preview

Show details for a virtual network.

Retrieve the full definition of a single virtual network, including its address space, subnets, and provisioning state. Use --expand to inline referenced sub-resources.

az network vnet show --name
                     --resource-group
                     [--expand]
                     [--profile]
                     [--subscription-id]

Examples

Show a virtual network

az network vnet show --name myvnet --resource-group myrg

Show using shell variables

az network vnet show --name $vnetName --resource-group $rg --subscription-id $subId

Show a virtual network with its subnet IP configurations expanded

az network vnet show --name myvnet --resource-group myrg --expand subnets/ipConfigurations

Required Parameters

--name -n

The name of the virtual network.

--resource-group -g

The resource group name.

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--expand

Expand referenced resources, e.g. subnets/ipConfigurations.

--profile

Use the named profile for this command (overrides the active profile).

--subscription-id

Azure Subscription Id. Defaults to the active profile's subscription.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h -help -? --?

Show help for the command or group and exit.

--no-cache

Bypass the extension discovery cache and reload extensions from disk.

--output -o

Output format.

Property Value
Default value: json
Accepted values: json, jsonc, table, tsv, yaml, yamlc
--query

JMESPath query string to filter/project the command result before rendering.