az network nic

az network nic

Manage network interfaces.

To learn more about network interfaces in Azure visit https://docs.microsoft.com/azure/virtual-network/virtual-network-network-interface.

In this article

Commands

az network nic create

Edit

Create a network interface.

az network nic create --name
                      --resource-group
                      --subnet
                      [--accelerated-networking {false, true}]
                      [--app-gateway-address-pools]
                      [--application-security-groups]
                      [--dns-servers]
                      [--edge-zone]
                      [--gateway-name]
                      [--internal-dns-name]
                      [--ip-forwarding {false, true}]
                      [--lb-address-pools]
                      [--lb-inbound-nat-rules]
                      [--lb-name]
                      [--location]
                      [--network-security-group]
                      [--no-wait]
                      [--private-ip-address]
                      [--private-ip-address-version {IPv4, IPv6}]
                      [--public-ip-address]
                      [--tags]
                      [--vnet-name]

Examples

Create a network interface for a specified subnet on a specified virtual network.

az network nic create -g MyResourceGroup --vnet-name MyVnet --subnet MySubnet -n MyNic

Create a network interface for a specified subnet on a virtual network which allows
IP forwarding subject to a network security group.

az network nic create -g MyResourceGroup --vnet-name MyVnet --subnet MySubnet -n MyNic \
    --ip-forwarding --network-security-group MyNsg

Create a network interface for a specified subnet on a virtual network with network security group and application security groups.

az network nic create -g MyResourceGroup --vnet-name MyVnet --subnet MySubnet -n MyNic \
    --network-security-group MyNsg --application-security-groups Web App

Required Parameters

–name -n

The network interface (NIC).

–resource-group -g

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

–subnet

Name or ID of an existing subnet. If name specified, also specify –vnet-name. If you want to use an existing subnet in other resource group, please provide the ID instead of the name of the subnet.

Optional Parameters

–accelerated-networking

Enable accelerated networking.

accepted values:

false, true

–app-gateway-address-pools

Space-separated list of names or IDs of application gateway backend address pools to associate with the NIC. If names are used, –gateway-name must be specified.

–application-security-groups –asgs

Space-separated list of application security groups.

–dns-servers

Space-separated list of DNS server IP addresses.

–edge-zone

The name of edge zone.

–gateway-name

The name of the application gateway to use when adding address pools by name (ignored when IDs are specified).

–internal-dns-name

The internal DNS name label.

–ip-forwarding

Enable IP forwarding.

accepted values:

false, true

default value:

False

–lb-address-pools

Space-separated list of names or IDs of load balancer address pools to associate with the NIC. If names are used, –lb-name must be specified.

–lb-inbound-nat-rules

Space-separated list of names or IDs of load balancer inbound NAT rules to associate with the NIC. If names are used, –lb-name must be specified.

–lb-name

The name of the load balancer to use when adding NAT rules or address pools by name (ignored when IDs are specified).

–location -l

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

–network-security-group

Name or ID of an existing network security group, or none by default.

–no-wait

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

default value:

False

–private-ip-address

Static private IP address to use.

–private-ip-address-version

The private IP address version to use.

accepted values:

IPv4, IPv6

default value:

IPv4

–public-ip-address

Name or ID of an existing public IP address, or none by default.

–tags

Space-separated tags: key[=value] [key[=value] …]. Use “” to clear existing tags.

–vnet-name

The virtual network (VNet) name.

Global Parameters

–debug

Increase logging verbosity to show all debug logs.

–help -h

Show this help message and exit.

–only-show-errors

Only show errors, suppressing warnings.

–output -o

Output format.

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

az network nic delete

Edit

Delete a network interface.

az network nic delete [--ids]
                      [--name]
                      [--no-wait]
                      [--resource-group]
                      [--subscription]

Examples

Delete a network interface.

az network nic delete -g MyResourceGroup -n MyNic

Optional Parameters

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

–name -n

The network interface (NIC).

–no-wait

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

default value:

False

–resource-group -g

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

–subscription

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

Global Parameters

–debug

Increase logging verbosity to show all debug logs.

–help -h

Show this help message and exit.

–only-show-errors

Only show errors, suppressing warnings.

–output -o

Output format.

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

az network nic list

Edit

List network interfaces.

To list network interfaces attached to VMs in VM scale sets use ‘az vmss nic list’ or ‘az vmss nic list-vm-nics’.

az network nic list [--resource-group]

Examples

List all NICs by internal DNS suffix.

az network nic list --query "[?dnsSettings.internalDomainNameSuffix=`{dnsSuffix}`]"

Optional Parameters

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

–help -h

Show this help message and exit.

–only-show-errors

Only show errors, suppressing warnings.

–output -o

Output format.

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

az network nic list-effective-nsg

Edit

List all effective network security groups applied to a network interface.

To learn more about troubleshooting using effective security rules visit https://docs.microsoft.com/azure/virtual-network/virtual-network-nsg-troubleshoot-portal.

az network nic list-effective-nsg [--ids]
                                  [--name]
                                  [--resource-group]
                                  [--subscription]

Examples

List the effective security groups associated with a NIC.

az network nic list-effective-nsg -g MyResourceGroup -n MyNic

Optional Parameters

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

–name -n

The network interface (NIC).

–resource-group -g

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

–subscription

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

Global Parameters

–debug

Increase logging verbosity to show all debug logs.

–help -h

Show this help message and exit.

–only-show-errors

Only show errors, suppressing warnings.

–output -o

Output format.

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

az network nic show

Edit

Get the details of a network interface.

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

Examples

Get the internal domain name suffix of a NIC.

az network nic show -g MyResourceGroup -n MyNic --query "dnsSettings.internalDomainNameSuffix"

Optional Parameters

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

–name -n

The network interface (NIC).

–resource-group -g

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

–subscription

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

Global Parameters

–debug

Increase logging verbosity to show all debug logs.

–help -h

Show this help message and exit.

–only-show-errors

Only show errors, suppressing warnings.

–output -o

Output format.

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

az network nic show-effective-route-table

Edit

Show the effective route table applied to a network interface.

To learn more about troubleshooting using the effective route tables visit https://docs.microsoft.com/azure/virtual-network/virtual-network-routes-troubleshoot-portal#using-effective-routes-to-troubleshoot-vm-traffic-flow.

az network nic show-effective-route-table [--ids]
                                          [--name]
                                          [--resource-group]
                                          [--subscription]

Examples

Show the effective routes applied to a network interface.

az network nic show-effective-route-table -g MyResourceGroup -n MyNic

Optional Parameters

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

–name -n

The network interface (NIC).

–resource-group -g

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

–subscription

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

Global Parameters

–debug

Increase logging verbosity to show all debug logs.

–help -h

Show this help message and exit.

–only-show-errors

Only show errors, suppressing warnings.

–output -o

Output format.

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

Update a network interface.

az network nic update [--accelerated-networking {false, true}]
                      [--add]
                      [--dns-servers]
                      [--force-string]
                      [--ids]
                      [--internal-dns-name]
                      [--ip-forwarding {false, true}]
                      [--name]
                      [--network-security-group]
                      [--no-wait]
                      [--remove]
                      [--resource-group]
                      [--set]
                      [--subscription]

Update a network interface to use a different network security group.

az network nic update -g MyResourceGroup -n MyNic --network-security-group MyNewNsg

Update a network interface. (autogenerated)

az network nic update --accelerated-networking true --name MyNic --resource-group MyResourceGroup

–accelerated-networking

Enable accelerated networking.

accepted values:

false, true

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

default value:

[]

–dns-servers

Space-separated list of DNS server IP addresses. Use “”(‘””‘ in PowerShell) to revert to default Azure servers.

–force-string

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

default value:

False

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

–internal-dns-name

The internal DNS name label.

–ip-forwarding

Enable IP forwarding.

accepted values:

false, true

–name -n

The network interface (NIC).

–network-security-group

Name or ID of the associated network security group.

–no-wait

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

default value:

False

–remove

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

default value:

[]

–resource-group -g

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

–set

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

default value:

[]

–subscription

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

Global Parameters

–debug

Increase logging verbosity to show all debug logs.

–help -h

Show this help message and exit.

–only-show-errors

Only show errors, suppressing warnings.

–output -o

Output format.

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

az network nic wait

Edit

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

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

Examples

Pause CLI until the network interface is created.

az network nic wait -g MyResourceGroup -n MyNic --created

Place the CLI in a waiting state until a condition of the network interface is met. (autogenerated)

az network nic wait --deleted --name MyNic --resource-group MyResourceGroup --subscription MySubscription

Optional Parameters

–created

Wait until created with ‘provisioningState’ at ‘Succeeded’.

default value:

False

–custom

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

–deleted

Wait until deleted.

default value:

False

–exists

Wait until the resource exists.

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.

–interval

Polling interval in seconds.

default value:

30

–name -n

The network interface (NIC).

–resource-group -g

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

–subscription

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

–timeout

Maximum wait in seconds.

default value:

3600

–updated

Wait until updated with provisioningState at ‘Succeeded’.

default value:

False
Global Parameters

–debug

Increase logging verbosity to show all debug logs.

–help -h

Show this help message and exit.

–only-show-errors

Only show errors, suppressing warnings.

–output -o

Output format.

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