none
Cannot remove network interface card on provisioned resource manager VM

    Question

  • I cannot remove NIC to a already provisioned resource manager VM.

    Powershell comands used give an error.

    $vm = Get-AzureVM -ResourceGroupName dev-rg -Name dev-app01
    Remove-AzureVMNetworkInterface -VM $vm -NetworkInterfaceIDs $vm.NetworkInterfaceIDs
    Update-AzureVM -VM $vm -ResourceGroupName dev-rg

    Debuged PShell:

    Body:
    {
      "error": {
        "code": "PropertyChangeNotAllowed",
        "target": "windowsConfiguration.additionalUnattendContent",
        "message": "Changing property 'windowsConfiguration.additionalUnattendContent' is not allowed."
      }
    }

    DEBUG: AzureQoSEvent: CmdletType - UpdateAzureVMCommand; IsSuccess - False; Duration - 00:05:02.4822503; Exception -
    Microsoft.WindowsAzure.Commands.Common.ComputeCloudException: PropertyChangeNotAllowed: Changing property
    'windowsConfiguration.additionalUnattendContent' is not allowed.
    OperationID : '0d731ad8-f6e3-4150-bea9-532e79e2b09d' ---> Hyak.Common.CloudException: PropertyChangeNotAllowed:
    Changing property 'windowsConfiguration.additionalUnattendContent' is not allowed.
       at Microsoft.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at Microsoft.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task)
       at Microsoft.Azure.Management.Compute.VirtualMachineOperationsExtensions.CreateOrUpdate(IVirtualMachineOperations
    operations, String resourceGroupName, VirtualMachine parameters)
       at Microsoft.Azure.Commands.Compute.UpdateAzureVMCommand.<ExecuteCmdlet>b__1()
       at Microsoft.Azure.Commands.Compute.ComputeClientBaseCmdlet.ExecuteClientAction(Action action)
       --- End of inner exception stack trace ---
       at Microsoft.Azure.Commands.Compute.ComputeClientBaseCmdlet.ExecuteClientAction(Action action)
       at Microsoft.Azure.Commands.Compute.UpdateAzureVMCommand.ExecuteCmdlet()
       at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord();
    DEBUG: Finish sending metric.

    Wednesday, September 16, 2015 7:27 PM

Answers

  • I managed to get this finally working, all commands need to be piped together. It might be a known issue but this worked for me, and it's only for replacing a single and only nic in vm.

    Get-AzureRMVM -ResourceGroupName xxx -Name yyy | Remove-AzureRmVMNetworkInterface -Id "old-nic-id" | Add-AzureRmVMNetworkInterface -Id "new-nic-ad" | Update-AzureRmVM


    Sunday, November 01, 2015 11:20 PM
  • Hello JozoSlejko,

    I was able to get a confirmation on this and, we this is currently a know issue. Adding and removing multiple NICs is currently not supported in Resource Manager. I suggest that you log a Feedback ticket to request for this.
    You can follow the link below to request for this:

    http://feedback.azure.com/forums/217313-azure-networking

    Thanks,
    Syed Irfan Hussain

    Tuesday, September 29, 2015 8:08 AM
    Moderator

All replies

  • Hello JozoSlejko,

    I am currently getting the same error when I try to repro this, I am currently checking if this is supported with our Operations Team. I will get back to you shortly.

    Thanks,
    Syed Irfan Hussain

    Thursday, September 17, 2015 2:04 PM
    Moderator
  • Hi,

    Are you trying to remove the secondary NIC?

    Best Regards
    Prasandhi Kumar

    Thursday, September 17, 2015 8:37 PM
    Moderator
  • I'm getting the error when trying to add a new NIC as well as remove an existing NIC from my VM.

    D:\Code\GT\Operations> Update-AzureVM -ResourceGroupName Brian-ResourceGroup -Name bjd-002 -VM $vm
    Update-AzureVM : PropertyChangeNotAllowed: Changing property 'windowsConfiguration.additionalUnattendContent' is not allowed.
    At line:1 char:1
    + Update-AzureVM -ResourceGroupName Brian-ResourceGroup -Name bjd-002 -VM $vm
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : CloseError: (:) [Update-AzureVM], CloudException
        + FullyQualifiedErrorId : Microsoft.Azure.Commands.Compute.UpdateAzureVMCommand

    Tuesday, September 22, 2015 6:51 PM
  • I'm trying to remove primary NIC, but also I cannot add a new NIC to the VM.
    Wednesday, September 23, 2015 12:36 PM
  • Thanks Syed.
    Wednesday, September 23, 2015 12:40 PM
  • Hello JozoSlejko,

    I was able to get a confirmation on this and, we this is currently a know issue. Adding and removing multiple NICs is currently not supported in Resource Manager. I suggest that you log a Feedback ticket to request for this.
    You can follow the link below to request for this:

    http://feedback.azure.com/forums/217313-azure-networking

    Thanks,
    Syed Irfan Hussain

    Tuesday, September 29, 2015 8:08 AM
    Moderator
  • Hi Syed,

    first of all, thanks for looking into this. 

    I don't understand why this isn't supported, PShell modules are there for it (e.g. remove-azurenetworkinterface). IMO this should be a standard operation since Resource Manager looks at NICs as separated objects.

    Jozo 

    Wednesday, September 30, 2015 7:21 AM
  • I managed to get this finally working, all commands need to be piped together. It might be a known issue but this worked for me, and it's only for replacing a single and only nic in vm.

    Get-AzureRMVM -ResourceGroupName xxx -Name yyy | Remove-AzureRmVMNetworkInterface -Id "old-nic-id" | Add-AzureRmVMNetworkInterface -Id "new-nic-ad" | Update-AzureRmVM


    Sunday, November 01, 2015 11:20 PM
  • I managed to get this finally working, all commands need to be piped together. It might be a known issue but this worked for me, and it's only for replacing a single and only nic in vm.

    Get-AzureRMVM -ResourceGroupName xxx -Name yyy | Remove-AzureRmVMNetworkInterface -Id "old-nic-id" | Add-AzureRmVMNetworkInterface -Id "new-nic-ad" | Update-AzureRmVM


    This worked for me, too... but I had to use a fully qualified name for the NIC. For example:

    Get-AzureRMVM -ResourceGroupName $RG -Name "PenderfootDC" | 
      Remove-AzureRmVMNetworkInterface -Id "/subscriptions/{id}/resourceGroups/{name}/providers/Microsoft.Network/networkInterfaces/{old-NIC-name}" | Add-AzureRmVMNetworkInterface -Id "/subscriptions/{id}/resourceGroups/{name}/providers/Microsoft.Network/networkInterfaces/{new-NIC-name}" | Update-AzureRmVM

    Tuesday, May 17, 2016 6:10 PM
  • Thanks, this work for me as well with the fully qualified name only.
    Friday, November 25, 2016 2:47 PM