locked
How To assign 2nd NICs to VM in Azure RRS feed

  • Question

  • hi,

    I want to assign assign 2nd NICs to VM in Azure but errors

    i fallow this article from 2nd part (Add Another NIC to an Existing VM)

    http://theithollow.com/2016/09/06/azure-network-interfaces/

    below is my code

    ------------------ Start---------------------------------------

    #Set Subscription Variables
    Add-AzureAccount

    $subscr="Visual Studio Ultimate with MSDN"

    Get-AzureRmSubscription –SubscriptionName $subscr | Select-AzureRmSubscription


    #Set Variables
    $VMname = "Exchange"
    $VMRG =  "MigrationExc"
    $NIC = "excN"
    $NicRG = "MigrationExc"


    ###################################################
    #DO NOT edit below this point                     #
    ###################################################
    #Get the VM
    $VM = Get-AzureRmVM -Name $VMname -ResourceGroupName $VMRG
    #Get the NIC
    $NewNIC =  Get-AzureRmNetworkInterface -Name $NIC -ResourceGroupName $NICRG

    #Add the NIC to the VM
    $VM = Add-AzureRmVMNetworkInterface -VM $VM -Id $NewNIC.Id

    #Reconfigure the VM
    #NOTE ------- VM WILL BE RESTARTED!!!!!!!!!!!!!!!!!!!!
    Update-AzureRmVM -VM $VM -ResourceGroupName $VMRG

    -------------------------END-------------------------------------------

    error after $VM = Get-AzureRmVM -Name $VMname -ResourceGroupName $VMRG

    Wednesday, January 25, 2017 6:17 PM

Answers

  • used the azure power shell for this purpose because through GUI this is not possible :)
    Friday, March 17, 2017 8:00 PM

All replies

  • please use to login to Azure using login-azureRMaccount before executing the command $VM=...
    Wednesday, January 25, 2017 8:54 PM
  • used the azure power shell for this purpose because through GUI this is not possible :)
    Friday, March 17, 2017 8:00 PM