You need to pass the name of NetworkInterfaceConfiguration
, not IPConfiguration
, and you should note myVmss.VirtualMachineProfile.NetworkProfile.NetworkInterfaceConfigurations.Name
is an array, so you need to give the specific one.
Before running Remove-AzVmssNetworkInterfaceConfiguration
, you may need to check $myVmss.VirtualMachineProfile.NetworkProfile.NetworkInterfaceConfigurations.Name
to confirm the NetworkInterfaceConfiguration
you want to remove.
For example, you want to remove Test
, then the command should be:
Remove-AzVmssNetworkInterfaceConfiguration -VirtualMachineScaleSet $myVmss -Name $myVmss.VirtualMachineProfile.NetworkProfile.NetworkInterfaceConfigurations.Name[1]
Just a tip:
To make it take effect, you need to stop the VMSS, then use Update-AzVmss
after Remove-AzVmssNetworkInterfaceConfiguration
.
$myVmss = Get-AzVmss -ResourceGroupName testvmss -VMScaleSetName myvmss
Remove-AzVmssNetworkInterfaceConfiguration -VirtualMachineScaleSet $myVmss -Name $myVmss.VirtualMachineProfile.NetworkProfile.NetworkInterfaceConfigurations.Name[1]
$myvmss | Update-AzVmss
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…