Add Existing NIC to Azure VM

This topic contains 0 replies, has 1 voice, and was last updated by  Barry 5 days ago.

  • Author
    Posts
  • #84062

    Barry
    Participant

    While learning how to create VM's my session timed out and I lost my variable for the NIC, so I am trying to figure out how to add the NIC. As you can see it does not accept the NIC ID. Any thoughts?

    PS Azure:\> $nicId = (Get-AzureRmNetworkInterface -ResourceGroupName "myRG" -Name "NIC1").Id

    PS Azure:\> $nicID
    /subscriptions/5................../resourceGroups/myRG/providers/Microsoft.N
    etwork/networkInterfaces/NIC1

    PS Azure:\> $vm = Add-AzureRmVMNetworkInterface -VM $vm -Id $nicID

    PS Azure:\> New-AzureRmVM -ResourceGroupname myRG -Location westUS -VM $vm
    New-AzureRmVM : Property id '5........' at path
    'properties.networkProfile.networkInterfaces[0].id' is invalid. Expect fully qualified
    resource Id that start with '/subscriptions/{subscriptionId}' or
    '/providers/{resourceProviderNamespace}/'.

You must be logged in to reply to this topic.