The Add-AzVMNetworkInterface cmdlet adds a network interface to a virtual machine.
You can add an interface when you create a virtual machine or add one to an existing virtual machine.
Examples
Example 1: Add a network interface to a new virtual machine
The first command creates a virtual machine object, and then stores it in the $VirtualMachine variable.
The command assigns a name and size to the virtual machine.
The second command adds a network interface to the virtual machine stored in $VirtualMachine.
Example 2: Add a network interface to an existing virtual machine
The first command gets the virtual machine named VirtualMachine07 by using the Get-AzVM cmdlet.
The command stores the virtual machine in the $VirtualMachine variable.
The second command adds a network interface to the virtual machine stored in $VirtualMachine.
The final command updates the state of the virtual machine stored in $VirtualMachine in ResourceGroup11.
Parameters
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with azure.
Specifies a local virtual machine object to which to add a network interface.
To create a virtual machine, use the New-AzVMConfig cmdlet.
To obtain an existing virtual machine, use the Get-AzVM cmdlet.
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.
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.