Edit

Share via


New-AzNetworkInterface

Creates a network interface.

Syntax

SetByIpConfigurationResource (Default)

New-AzNetworkInterface
    -Name <String>
    -ResourceGroupName <String>
    -Location <String>
    -IpConfiguration <PSNetworkInterfaceIPConfiguration[]>
    [-EdgeZone <String>]
    [-DnsServer <String[]>]
    [-InternalDnsNameLabel <String>]
    [-DisableTcpStateTracking <String>]
    [-EnableIPForwarding]
    [-EnableAcceleratedNetworking]
    [-AuxiliaryMode <String>]
    [-AuxiliarySku <String>]
    [-Tag <Hashtable>]
    [-Force]
    [-AsJob]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

SetByIpConfigurationResourceId

New-AzNetworkInterface
    -Name <String>
    -ResourceGroupName <String>
    -Location <String>
    -IpConfiguration <PSNetworkInterfaceIPConfiguration[]>
    [-EdgeZone <String>]
    [-NetworkSecurityGroupId <String>]
    [-NetworkSecurityGroup <PSNetworkSecurityGroup>]
    [-DnsServer <String[]>]
    [-InternalDnsNameLabel <String>]
    [-DisableTcpStateTracking <String>]
    [-EnableIPForwarding]
    [-EnableAcceleratedNetworking]
    [-AuxiliaryMode <String>]
    [-AuxiliarySku <String>]
    [-Tag <Hashtable>]
    [-Force]
    [-AsJob]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

SetByResourceId

New-AzNetworkInterface
    -Name <String>
    -ResourceGroupName <String>
    -Location <String>
    -SubnetId <String>
    [-EdgeZone <String>]
    [-PublicIpAddressId <String>]
    [-NetworkSecurityGroupId <String>]
    [-LoadBalancerBackendAddressPoolId <String[]>]
    [-LoadBalancerInboundNatRuleId <String[]>]
    [-ApplicationGatewayBackendAddressPoolId <String[]>]
    [-ApplicationSecurityGroupId <String[]>]
    [-PrivateIpAddress <String>]
    [-IpConfigurationName <String>]
    [-DnsServer <String[]>]
    [-InternalDnsNameLabel <String>]
    [-DisableTcpStateTracking <String>]
    [-EnableIPForwarding]
    [-EnableAcceleratedNetworking]
    [-AuxiliaryMode <String>]
    [-AuxiliarySku <String>]
    [-Tag <Hashtable>]
    [-Force]
    [-AsJob]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

SetByResource

New-AzNetworkInterface
    -Name <String>
    -ResourceGroupName <String>
    -Location <String>
    -Subnet <PSSubnet>
    [-EdgeZone <String>]
    [-PublicIpAddress <PSPublicIpAddress>]
    [-NetworkSecurityGroup <PSNetworkSecurityGroup>]
    [-LoadBalancerBackendAddressPool <PSBackendAddressPool[]>]
    [-LoadBalancerInboundNatRule <PSInboundNatRule[]>]
    [-ApplicationGatewayBackendAddressPool <PSApplicationGatewayBackendAddressPool[]>]
    [-ApplicationSecurityGroup <PSApplicationSecurityGroup[]>]
    [-PrivateIpAddress <String>]
    [-IpConfigurationName <String>]
    [-DnsServer <String[]>]
    [-InternalDnsNameLabel <String>]
    [-DisableTcpStateTracking <String>]
    [-EnableIPForwarding]
    [-EnableAcceleratedNetworking]
    [-AuxiliaryMode <String>]
    [-AuxiliarySku <String>]
    [-Tag <Hashtable>]
    [-Force]
    [-AsJob]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

The New-AzNetworkInterface cmdlet creates an Azure network interface.

Examples

Example 1: Create an Azure network interface

New-AzNetworkInterface -Name "NetworkInterface1" -ResourceGroupName "ResourceGroup1" -Location "centralus" -SubnetId "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/ResourceGroup1/providers/Microsoft.Network/virtualNetworks/VirtualNetwork1/subnets/Subnet1" -IpConfigurationName "IPConfiguration1" -DnsServer "8.8.8.8", "8.8.4.4"

This command creates a network interface named NetworkInterface001 with a dynamically assigned private IP address from Subnet1 in the virtual network named VirtualNetwork1. The command also assigns two DNS servers to the network interface. The IPConfiguration child resource will be created automatically using the name IPConfiguration1.

Example 2: Create an Azure network interface using an IP configuration object

$Subnet = Get-AzVirtualNetwork -Name "VirtualNetwork1" -ResourceGroupName "ResourceGroup1"
$IPconfig = New-AzNetworkInterfaceIpConfig -Name "IPConfig1" -PrivateIpAddressVersion IPv4 -PrivateIpAddress "10.0.1.10" -SubnetId $Subnet.Subnets[0].Id
New-AzNetworkInterface -Name "NetworkInterface1" -ResourceGroupName "ResourceGroup1" -Location "centralus" -IpConfiguration $IPconfig

This example creates a new network interface using an IP configuration object. The IP configuration object specifies a static private IPv4 address. The first command retrieves an existing specified virtual network used to assign the subnet in the second command. The second command creates a network interface IP configuration named IPConfig1 and stores the configuration in the variable named $IPconfig. The third command creates a network interface named NetworkInterface1 that uses the network interface IP configuration stored in the variable named $IPconfig.

Example 3

Creates a network interface. (autogenerated)

New-AzNetworkInterface -Location 'West US' -Name 'NetworkInterface1' -PrivateIpAddress '10.0.1.10' -ResourceGroupName 'ResourceGroup1' -SubnetId '/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/ResourceGroup1/providers/Microsoft.Network/virtualNetworks/VirtualNetwork1/subnets/Subnet1'

Parameters

-ApplicationGatewayBackendAddressPool

Specifies an ApplicationGatewayBackendAddressPool object.

Parameter properties

Type:

PSApplicationGatewayBackendAddressPool[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SetByResource
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-ApplicationGatewayBackendAddressPoolId

Specifies the ID of a ApplicationGatewayBackendAddressPool object.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SetByResourceId
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-ApplicationSecurityGroup

Specifies a collection of application security group references to which the network interface IP configuration should belong to.

Parameter properties

Type:

PSApplicationSecurityGroup[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SetByResource
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-ApplicationSecurityGroupId

Specifies a collection of application security group references to which the network interface IP configuration should belong to.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SetByResourceId
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-AsJob

Run cmdlet in the background

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-AuxiliaryMode

The auxiliary mode of the Network Interface

Parameter properties

Type:String
Default value:None
Accepted values:None, MaxConnections, AcceleratedConnections, Floating
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-AuxiliarySku

The auxiliary sku of the Network Interface

Parameter properties

Type:String
Default value:None
Accepted values:None, A1, A2, A4, A8
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with azure.

Parameter properties

Type:IAzureContextContainer
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzContext, AzureRmContext, AzureCredential

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DisableTcpStateTracking

Indicates whether to disable tcp state tracking.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-DnsServer

Specifies the DNS server for the network interface.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-EdgeZone

The edge zone of the network interface

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-EnableAcceleratedNetworking

Enables accelerated networking.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-EnableIPForwarding

Indicates that this cmdlet enables IP forwarding for the network interface. IP forwarding allows a virtual machine to receive traffic addressed to other destinations.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Force

Forces the creation of the network interface even if a network interface with the same name already exists.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-InternalDnsNameLabel

Specifies the internal DNS name label for the new network interface.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-IpConfiguration

Specifies the IP configuration that this cmdlet uses for the network interface.

Parameter properties

Type:

PSNetworkInterfaceIPConfiguration[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SetByIpConfigurationResource
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
SetByIpConfigurationResourceId
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-IpConfigurationName

Specifies the name of an IP configuration.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SetByResourceId
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
SetByResource
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-LoadBalancerBackendAddressPool

Specifies a BackendAddressPool object.

Parameter properties

Type:

PSBackendAddressPool[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SetByResource
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-LoadBalancerBackendAddressPoolId

Specifies the ID of a BackendAddressPool object.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SetByResourceId
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-LoadBalancerInboundNatRule

Specifies an inbound NAT rule configuration for a load balancer.

Parameter properties

Type:

PSInboundNatRule[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SetByResource
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-LoadBalancerInboundNatRuleId

Specifies the ID of an inbound NAT rule configuration for a load balancer.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SetByResourceId
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Location

Specifies the region for a network interface.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Name

Specifies the name of the network interface to create.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:ResourceName

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-NetworkSecurityGroup

Specifies a NetworkSecurityGroup object.

Parameter properties

Type:PSNetworkSecurityGroup
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SetByIpConfigurationResourceId
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
SetByResource
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-NetworkSecurityGroupId

Specifies the ID of a network security group.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SetByIpConfigurationResourceId
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
SetByResourceId
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-PrivateIpAddress

Specifies a static IPv4 IP address to assign to this network interface.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SetByResourceId
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
SetByResource
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-PublicIpAddress

Specifies a PublicIPAddress object to assign to a network interface.

Parameter properties

Type:PSPublicIpAddress
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SetByResource
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-PublicIpAddressId

Specifies the ID of a PublicIPAddress object to assign to a network interface.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SetByResourceId
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-ResourceGroupName

Specifies the name of a resource group that the network interface belongs to.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Subnet

Specifies a Subnet object. This cmdlet creates a network interface for the subnet that this parameter specifies.

Parameter properties

Type:PSSubnet
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SetByResource
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-SubnetId

Specifies the ID of the subnet for which to create a network interface.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SetByResourceId
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Tag

Key-value pairs in the form of a hash table. For example: @{key0="value0";key1=$null;key2="value2"}

Parameter properties

Type:Hashtable
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

String

PSNetworkInterfaceIPConfiguration

PSSubnet

PSPublicIpAddress

PSNetworkSecurityGroup

String

PSBackendAddressPool

PSInboundNatRule

PSApplicationGatewayBackendAddressPool

PSApplicationSecurityGroup

Hashtable

Outputs

PSNetworkInterface