Author Posts

November 13, 2017 at 12:14 am

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}/'.