Add-AzVMNetworkInterfaceConfiguration
Adds an implicit network interface configuration to a virtual machine.
Syntax
Default (Default)
Add-AzVMNetworkInterfaceConfiguration
[-VM] <PSVirtualMachine>
[-Name <String>]
[-Primary]
[-IpConfiguration <VirtualMachineNetworkInterfaceIPConfiguration[]>]
[-NetworkApiVersion <String>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
The Add-AzVMNetworkInterfaceConfiguration cmdlet adds an implicit network interface configuration to a configurable virtual machine (VM) object.
It initializes the network profile when needed and preserves existing network interface configurations.
Examples
Example 1: Add an implicit network interface with a first-party service IP tag
$serviceTagResourceId = '/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/firstPartyServiceTags/myServiceTag'
$subnetId = '/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVNet/subnets/mySubnet'
$ipTag = New-AzVMIpTagConfig -IpTagType 'FirstPartyUsage' -FirstPartyServiceTagId $serviceTagResourceId
$ipConfig = New-AzVMIpConfig -Name 'ipConfig' -SubnetId $subnetId -PublicIPAddressConfigurationName 'publicIpConfig' -IpTag $ipTag
$vmConfig = New-AzVMConfig -VMName 'myVM' -VMSize 'Standard_D2s_v5'
$vmConfig = Add-AzVMNetworkInterfaceConfiguration -VM $vmConfig -Name 'nicConfig' -Primary -IpConfiguration $ipConfig -NetworkApiVersion '2022-11-01'
This example adds an implicit network interface and nested public IP configuration to a VM configuration object.
Parameters
-Confirm
Prompts you for confirmation before running the cmdlet.
Parameter properties
Type: SwitchParameter
Default value: None
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
-IpConfiguration
Specifies the IP configurations to add to the network interface configuration.
Parameter properties
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-Name
Specifies the network interface configuration name.
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
-NetworkApiVersion
Specifies the Microsoft.Network API version used to create the implicit networking resources.
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
-Primary
Specifies whether this is the primary network interface configuration.
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
-VM
Specifies the configurable VM object to update.
Create the object with New-AzVMConfig .
Parameter properties
Type: PSVirtualMachine
Default value: None
Supports wildcards: False
DontShow: False
Aliases: VirtualMachine
Parameter sets
(All)
Position: Named
Mandatory: True
Value from pipeline: True
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: None
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 .
Outputs