Add-AzStackHCIVMVirtualMachineNetworkInterface

The operation to add a network interface to a virtual machine.

Syntax

Add-AzStackHCIVMVirtualMachineNetworkInterface
   -ResourceId <String>
   [-NicId <String[]>]
   [-NicName <String[]>]
   [-NicResourceGroup <String>]
   [-NoWait]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Add-AzStackHCIVMVirtualMachineNetworkInterface
   -Name <String>
   -ResourceGroupName <String>
   [-SubscriptionId <String>]
   [-NicId <String[]>]
   [-NicName <String[]>]
   [-NicResourceGroup <String>]
   [-NoWait]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

The operation to add a network interface to a virtual machine.

Examples

Example 1: Add a Network Interface to a Virtual Machine

Add-AzStackHCIVMVirtualMachineNetworkInterface  -Name 'testVm' -ResourceGroupName 'test-rg'  -NicName 'testNic'

Name            ResourceGroupName
----            -----------------
testVm          test-rg

This command attaches a network interface to the virtual machine in the specified resource group.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Name

Name of the virtual machine

Type:String
Aliases:VirtualMachineName
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-NicId

NetworkInterfaces - list of network interfaces to be attached to the virtual machine in id format

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-NicName

NetworkInterfaces - list of network interfaces to be attached to the virtual machine in name format

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-NicResourceGroup

Resource Group of the Network Interfaces

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-NoWait

Run the command asynchronously

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ResourceGroupName

The name of the resource group. The name is case insensitive.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-ResourceId

The ARM Id of the Virtual Machine

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-SubscriptionId

The ID of the target subscription.

Type:String
Position:Named
Default value:(Get-AzContext).Subscription.Id
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-WhatIf

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

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Outputs

IVirtualMachineInstance