Tuesday, 5 September 2017

Making changes to Azure IaaS VM NIC's in Azure Resource Manager using Powershell



Stop-AzureRmVM -Name "myNVA" -ResourceGroupName "myNVA"

$vm = Get-AzureRmVm -Name "myNVA" -ResourceGroupName "myNVA"
$vm.NetworkProfile.NetworkInterfaces
$nicId = (Get-AzureRmNetworkInterface -ResourceGroupName "myNVA" -Name "myNVA-eth0").Id

Remove-AzureRmVMNetworkInterface -VM $vm -NetworkInterfaceIDs $nicId

Update-AzureRmVm -ResourceGroupName "myNVA"