مشاركة عبر


az network vnet

Note

This command group has commands that are defined in both Azure CLI and at least one extension. Install each extension to benefit from its extended capabilities. Learn more about extensions.

Check if a private IP address is available for use within a virtual network.

To learn more about Virtual Networks visit https://learn.microsoft.com/azure/virtual-network/virtual-network-manage-network.

Commands

Name Description Type Status
az network vnet check-ip-address

Check if a private IP address is available for use within a virtual network.

Core GA
az network vnet create

Create a virtual network.

Core GA
az network vnet delete

Delete a virtual network.

Core GA
az network vnet list

List virtual networks.

Core GA
az network vnet list-available-ips

List some available ips in the vnet.

Core Preview
az network vnet list-endpoint-services

List which services support VNet service tunneling in a given region.

Core GA
az network vnet peering

Manage peering connections between Azure Virtual Networks.

Core GA
az network vnet peering create

Create a virtual network peering connection.

Core GA
az network vnet peering delete

Delete a peering.

Core GA
az network vnet peering list

List peerings.

Core GA
az network vnet peering show

Show details of a peering.

Core GA
az network vnet peering sync

Sync a virtual network peering connection.

Core GA
az network vnet peering update

Update a peering in the specified virtual network.

Core GA
az network vnet peering wait

Place the CLI in a waiting state until a condition is met.

Core GA
az network vnet show

Get the details of a virtual network.

Core GA
az network vnet subnet

Manage subnets in an Azure Virtual Network.

Core GA
az network vnet subnet create

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

Core GA
az network vnet subnet delete

Delete a subnet.

Core GA
az network vnet subnet list

List the subnets in a virtual network.

Core GA
az network vnet subnet list-available-delegations

List the services available for subnet delegation.

Core GA
az network vnet subnet list-available-ips

List some available ips in the subnet.

Core Preview
az network vnet subnet show

Show details of a subnet.

Core GA
az network vnet subnet update

Update a subnet.

Core GA
az network vnet subnet wait

Place the CLI in a waiting state until a condition is met.

Core GA
az network vnet tap

Manage virtual network taps.

Extension GA
az network vnet tap create

Create a virtual network tap.

Extension GA
az network vnet tap delete

Delete a virtual network tap.

Extension GA
az network vnet tap list

List virtual network taps.

Extension GA
az network vnet tap show

Get the details of a virtual network tap.

Extension GA
az network vnet tap update

Update settings of a virtual network tap.

Extension GA
az network vnet tap wait

Place the CLI in a waiting state until a condition is met.

Extension GA
az network vnet update

Update a virtual network.

Core GA
az network vnet wait

Place the CLI in a waiting state until a condition is met.

Core GA

az network vnet check-ip-address

Check if a private IP address is available for use within a virtual network.

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

Examples

Check whether 10.0.0.4 is available within MyVnet.

az network vnet check-ip-address -g MyResourceGroup -n MyVnet --ip-address 10.0.0.4

Required Parameters

--ip-address

The private IP address to be verified.

--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>.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

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

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

Property Value
Default value: False

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. To learn about how to create a virtual network visit https://learn.microsoft.com/azure/virtual-network/manage-virtual-network#create-a-virtual-network.

az network vnet create --name
                       --resource-group
                       [--address-prefixes]
                       [--bgp-community]
                       [--ddos-protection {0, 1, f, false, n, no, t, true, y, yes}]
                       [--ddos-protection-plan]
                       [--dns-servers]
                       [--edge-zone]
                       [--enable-encryption {0, 1, f, false, n, no, t, true, y, yes}]
                       [--encryption-enforcement-policy --encryption-policy {AllowUnencrypted, DropUnencrypted}]
                       [--flowtimeout]
                       [--ipam-allocations --ipam-pool-prefix-allocations]
                       [--location]
                       [--network-security-group --nsg]
                       [--no-wait {0, 1, f, false, n, no, t, true, y, yes}]
                       [--pe-vnet-policies --private-endpoint-vnet-policies {Basic, Disabled}]
                       [--subnet-name]
                       [--subnet-prefixes]
                       [--subnets]
                       [--tags]
                       [--vm-protection {0, 1, f, false, n, no, t, true, y, yes}]

Examples

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-prefixes 10.0.0.0/24

Create a virtual network.

az network vnet create --address-prefixes 10.0.0.0/16 --name MyVirtualNetwork --resource-group MyResourceGroup --subnet-name MyAseSubnet --subnet-prefixes 10.0.0.0/24

Create virtual network with an IPAM pool allocation.

az network vnet create -g MyResourceGroup -n MyVNet --ipam-allocations [0].number-of-ip-addresses=100 [0].id=ipam-pool-resource-id

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

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

--address-prefixes

Space-separated list of IP address prefixes for the VNet. Default: 10.0.0.0/16. If provided, --ipam-allocations should not be specified. Support shorthand-syntax, json-file and yaml-file. Try "??" to show more.

Property Value
Default value: ['10.0.0.0/16']
--bgp-community

The BGP community associated with the virtual network.

--ddos-protection

Control whether DDoS protection is enabled.

Property Value
Default value: False
Accepted values: 0, 1, f, false, n, no, t, true, y, yes
--ddos-protection-plan

Name or ID of a DDoS protection plan to associate with the VNet.

--dns-servers

Space-separated list of DNS server IP addresses. Support shorthand-syntax, json-file and yaml-file. Try "??" to show more.

--edge-zone

The name of edge zone.

--enable-encryption

Enable encryption on the virtual network.

Property Value
Accepted values: 0, 1, f, false, n, no, t, true, y, yes
--encryption-enforcement-policy --encryption-policy

To control if the Virtual Machine without encryption is allowed in encrypted Virtual Network or not.

Property Value
Accepted values: AllowUnencrypted, DropUnencrypted
--flowtimeout

The FlowTimeout value (in minutes) for the Virtual Network.

--ipam-allocations --ipam-pool-prefix-allocations

A list of IPAM Pools allocating IP address prefixes. If provided, --address-prefixes would be ignored and should not be specified. Support shorthand-syntax, json-file and yaml-file. Try "??" to show more.

Property Value
Parameter group: AddressSpace Arguments
--location -l

Resource location.

--network-security-group --nsg

Name or ID of a network security group (NSG).

Property Value
Parameter group: Subnet Arguments
--no-wait

Do not wait for the long-running operation to finish.

Property Value
Accepted values: 0, 1, f, false, n, no, t, true, y, yes
--pe-vnet-policies --private-endpoint-vnet-policies

Private Endpoint VNet Policies.

Property Value
Accepted values: Basic, Disabled
--subnet-name

Name of a new subnet to create within the VNet.

Property Value
Parameter group: Subnet Arguments
--subnet-prefixes

Space-separated list of address prefixes in CIDR format for the new subnet. If omitted, automatically reserves a /24 (or as large as available) block within the VNet address space. Support shorthand-syntax, json-file and yaml-file. Try "??" to show more.

Property Value
Parameter group: Subnet Arguments
--subnets

Manage a list of subnets in a Virtual Network (similar to az network vnet subnet). Support shorthand-syntax, json-file and yaml-file. Try "??" to show more.

Property Value
Parameter group: Subnet Arguments
--tags

Space-separated tags: key[=value] [key[=value] ...]. Support shorthand-syntax, json-file and yaml-file. Try "??" to show more.

--vm-protection

Enable VM protection for all subnets in the VNet.

Property Value
Default value: False
Accepted values: 0, 1, f, false, n, no, t, true, y, yes
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

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

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

Property Value
Default value: False

az network vnet delete

Delete a virtual network.

az network vnet delete [--ids]
                       [--name]
                       [--no-wait {0, 1, f, false, n, no, t, true, y, yes}]
                       [--resource-group]
                       [--subscription]

Examples

Delete a virtual network.

az network vnet delete -g MyResourceGroup -n myVNet

Optional Parameters

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

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

Property Value
Parameter group: Resource Id Arguments
--name -n

The virtual network (VNet) name.

Property Value
Parameter group: Resource Id Arguments
--no-wait

Do not wait for the long-running operation to finish.

Property Value
Accepted values: 0, 1, f, false, n, no, t, true, y, yes
--resource-group -g

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

Property Value
Parameter group: Resource Id Arguments
--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

Property Value
Parameter group: Resource Id Arguments
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

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

JMESPath query string. See http://jmespath.org/ for more information and examples.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

Property Value
Default value: False

az network vnet list

List virtual networks.

az network vnet list [--max-items]
                     [--next-token]
                     [--resource-group]

Examples

List all virtual networks in a subscription.

az network vnet list

List all virtual networks in a resource group.

az network vnet list -g MyResourceGroup

List virtual networks in a subscription which specify a certain address prefix.

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

Optional Parameters

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

--max-items

Total number of items to return in the command's output. If the total number of items available is more than the value specified, a token is provided in the command's output. To resume pagination, provide the token value in --next-token argument of a subsequent command.

Property Value
Parameter group: Pagination Arguments
--next-token

Token to specify where to start paginating. This is the token value from a previously truncated response.

Property Value
Parameter group: Pagination Arguments
--resource-group -g

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

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

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

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

Property Value
Default value: False

az network vnet list-available-ips

Preview

This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

List some available ips in the vnet.

az network vnet list-available-ips [--ids]
                                   [--name]
                                   [--resource-group]
                                   [--subscription]

Examples

List some available ips in the vnet.

az network vnet list-available-ips -g MyResourceGroup -n MyVNet

Optional Parameters

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

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

Property Value
Parameter group: Resource Id Arguments
--name -n

The virtual network (VNet) name.

Property Value
Parameter group: Resource Id Arguments
--resource-group -g

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

Property Value
Parameter group: Resource Id Arguments
--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

Property Value
Parameter group: Resource Id Arguments
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

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

JMESPath query string. See http://jmespath.org/ for more information and examples.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

Property Value
Default value: False

az network vnet list-endpoint-services

List which services support VNet service tunneling in a given region.

az network vnet list-endpoint-services --location
                                       [--max-items]
                                       [--next-token]

Examples

List the endpoint services available for use in the West US region.

az network vnet list-endpoint-services -l westus -o table

Required Parameters

--location -l

Location. Values from: az account list-locations. You can configure the default location using az configure --defaults location=<location>.

Optional Parameters

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

--max-items

Total number of items to return in the command's output. If the total number of items available is more than the value specified, a token is provided in the command's output. To resume pagination, provide the token value in --next-token argument of a subsequent command.

Property Value
Parameter group: Pagination Arguments
--next-token

Token to specify where to start paginating. This is the token value from a previously truncated response.

Property Value
Parameter group: Pagination Arguments
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

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

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

Property Value
Default value: False

az network vnet show

Get the details of a virtual network.

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

Examples

Get details for MyVNet.

az network vnet show -g MyResourceGroup -n MyVNet

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

Expands referenced resources. Default value is None.

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

Property Value
Parameter group: Resource Id Arguments
--name -n

The virtual network (VNet) name.

Property Value
Parameter group: Resource Id Arguments
--resource-group -g

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

Property Value
Parameter group: Resource Id Arguments
--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

Property Value
Parameter group: Resource Id Arguments
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

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

JMESPath query string. See http://jmespath.org/ for more information and examples.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

Property Value
Default value: False

az network vnet update

Update a virtual network.

az network vnet update [--add]
                       [--address-prefixes]
                       [--bgp-community]
                       [--ddos-protection {0, 1, f, false, n, no, t, true, y, yes}]
                       [--ddos-protection-plan]
                       [--dns-servers]
                       [--enable-encryption {0, 1, f, false, n, no, t, true, y, yes}]
                       [--encryption-enforcement-policy --encryption-policy {AllowUnencrypted, DropUnencrypted}]
                       [--flowtimeout]
                       [--force-string {0, 1, f, false, n, no, t, true, y, yes}]
                       [--ids]
                       [--ipam-allocations --ipam-pool-prefix-allocations]
                       [--name]
                       [--no-wait {0, 1, f, false, n, no, t, true, y, yes}]
                       [--pe-vnet-policies --private-endpoint-vnet-policies {Basic, Disabled}]
                       [--remove]
                       [--resource-group]
                       [--set]
                       [--subscription]
                       [--vm-protection {0, 1, f, false, n, no, t, true, y, yes}]

Examples

Update a virtual network with the IP address of a DNS server.

az network vnet update -g MyResourceGroup -n MyVNet --dns-servers 10.2.0.8

Update a virtual network.

az network vnet update --address-prefixes 40.1.0.0/24 --name MyVNet --resource-group MyResourceGroup

Update a virtual network to delete DNS server.

az network vnet update -g MyResourceGroup -n MyVNet --dns-servers null

Optional Parameters

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

--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>.

Property Value
Parameter group: Generic Update Arguments
--address-prefixes

Space-separated list of IP address prefixes for the VNet. Default: 10.0.0.0/16. If provided, --ipam-allocations should not be specified. Support shorthand-syntax, json-file and yaml-file. Try "??" to show more.

--bgp-community

The BGP community associated with the virtual network.

--ddos-protection

Control whether DDoS protection is enabled.

Property Value
Accepted values: 0, 1, f, false, n, no, t, true, y, yes
--ddos-protection-plan

Name or ID of a DDoS protection plan to associate with the VNet.

--dns-servers

Space-separated list of DNS server IP addresses. Support shorthand-syntax, json-file and yaml-file. Try "??" to show more.

--enable-encryption

Enable encryption on the virtual network.

Property Value
Accepted values: 0, 1, f, false, n, no, t, true, y, yes
--encryption-enforcement-policy --encryption-policy

To control if the Virtual Machine without encryption is allowed in encrypted Virtual Network or not.

Property Value
Accepted values: AllowUnencrypted, DropUnencrypted
--flowtimeout

The FlowTimeout value (in minutes) for the Virtual Network.

--force-string

When using 'set' or 'add', preserve string literals instead of attempting to convert to JSON.

Property Value
Parameter group: Generic Update Arguments
Accepted values: 0, 1, f, false, n, no, t, true, y, yes
--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

Property Value
Parameter group: Resource Id Arguments
--ipam-allocations --ipam-pool-prefix-allocations

A list of IPAM Pools allocating IP address prefixes. If a non-empty value is provided, --address-prefixes would be ignored. Support shorthand-syntax, json-file and yaml-file. Try "??" to show more.

Property Value
Parameter group: AddressSpace Arguments
--name -n

The virtual network (VNet) name.

Property Value
Parameter group: Resource Id Arguments
--no-wait

Do not wait for the long-running operation to finish.

Property Value
Accepted values: 0, 1, f, false, n, no, t, true, y, yes
--pe-vnet-policies --private-endpoint-vnet-policies

Private Endpoint VNet Policies.

Property Value
Accepted values: Basic, Disabled
--remove

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

Property Value
Parameter group: Generic Update Arguments
--resource-group -g

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

Property Value
Parameter group: Resource Id Arguments
--set

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

Property Value
Parameter group: Generic Update Arguments
--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

Property Value
Parameter group: Resource Id Arguments
--vm-protection

Enable VM protection for all subnets in the VNet.

Property Value
Accepted values: 0, 1, f, false, n, no, t, true, y, yes
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

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

JMESPath query string. See http://jmespath.org/ for more information and examples.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

Property Value
Default value: False

az network vnet wait

Place the CLI in a waiting state until a condition is met.

az network vnet wait [--created]
                     [--custom]
                     [--deleted]
                     [--exists]
                     [--expand]
                     [--ids]
                     [--interval]
                     [--name]
                     [--resource-group]
                     [--subscription]
                     [--timeout]
                     [--updated]

Optional Parameters

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

--created

Wait until created with 'provisioningState' at 'Succeeded'.

Property Value
Parameter group: Wait Condition Arguments
Default value: False
--custom

Wait until the condition satisfies a custom JMESPath query. E.g. provisioningState!='InProgress', instanceView.statuses[?code=='PowerState/running'].

Property Value
Parameter group: Wait Condition Arguments
--deleted

Wait until deleted.

Property Value
Parameter group: Wait Condition Arguments
Default value: False
--exists

Wait until the resource exists.

Property Value
Parameter group: Wait Condition Arguments
Default value: False
--expand

Expands referenced resources. Default value is None.

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

Property Value
Parameter group: Resource Id Arguments
--interval

Polling interval in seconds.

Property Value
Parameter group: Wait Condition Arguments
Default value: 30
--name -n

The virtual network (VNet) name.

Property Value
Parameter group: Resource Id Arguments
--resource-group -g

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

Property Value
Parameter group: Resource Id Arguments
--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

Property Value
Parameter group: Resource Id Arguments
--timeout

Maximum wait in seconds.

Property Value
Parameter group: Wait Condition Arguments
Default value: 3600
--updated

Wait until updated with provisioningState at 'Succeeded'.

Property Value
Parameter group: Wait Condition Arguments
Default value: False
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

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

JMESPath query string. See http://jmespath.org/ for more information and examples.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

Property Value
Default value: False