FIX: enable network adapter Virtual Machine in Azure by Bas Wijdenes

Network Adapters and Virtual Machines in Azure.

I have several virtual machines within my own test tenant. I did not manage to get the new machine within the domain. Somehow DNS screwed something up.

Because of this I came up with the brilliant idea to temporarily switch off the network adapter and then restart it in a few seconds. After disabling the network adapter, I immediately lost my connection with the Virtual machine in Azure.

Alright, how can you connect to a Virtual Machine in the Azure cloud that does not have a network adapter enabled? No idea what I thought.


Let’s re-enable the Network Adapter on an Azure VM, or actually… let’s add a new network interface.

Okay this is a refurbished post. More about that in the Summary.

Until a few years ago this was a more annoying problem than now. first you had to remove the old Network Interface and then add a new one, all via PowerShell. You could not then create a new Network Interface and link it within the Azure GUI. Now that is possible though.


Let’s first create a new Network Interface.

First let’s create a new network interface within the Azure portal.
See the screenshot below.
Go to All Services and search for Network Interfaces.

Disabled network adapter Azure VM
Disabled network adapter Azure VM.

Click on Add to add a new network interface.

Enable Network Adapter Azure VM.
Enable Network Adapter Azure VM.

Enter the correct information here.
Choose the virtual Network that the Virtual Machine is currently in. You do not need to create a new one for this.
For IP Address, enter a different address than the existing Network Interface (which is disabled).

re-enable network adapter Azure VM.
Re-enable network adapter Azure VM.

Let’s re-enable internet connectivity for the VM.

Now that we have a new network interface, we can link it to the Virtual Machine.
Go to the VM in the Azure Portal and switch it off temporarily.

Open Networking and click on Attach network Interface.
Add your new network interface and restart the VM.
You could now connect to the vm with the new IP address.

Disabled network interface Azure VM.
Disabled network interface Azure VM.

Keep in mind that when you use a NSG with port 3389 blocked you still can not connect.
Did your previous network interface have an external IP address and did you make a connection via the internet? Then add an external IP address to the new network interface.


Summary

The post was often viewed, but the old content was no longer relevant with what it is now. Within Azure you can now more easily connect a Network interface to a Virtual Machine. And therefore, I’ve refurbished the post.

On 22 October 2018 I modified the post and re-published it.


A little extra

This post contains PowerShell. Would you like to learn the basics better? I have created a new website to learn basic PowerShell in an ’emulator’ environment.
Click here to go learn Basic PowerShell.

Published by

Bas

My name is Bas Wijdenes and I work full-time as a Services Engineer. In my spare time I write about the error messages that I encounter during my work. Furthermore, I am currently occupied with Office 365, Azure infra, and PowerShell for automating daily tasks.

2 thoughts on “FIX: enable network adapter Virtual Machine in Azure by Bas Wijdenes”

  1. Hi Bas, nice article and troubleshooting.

    I encounter the below error while running the last command:

    Get-AzureRmVM : Cannot bind parameter because parameter ‘Name’ is specified more than once. To provide multiple values
    to parameters that can accept multiple values, use the array syntax. For example, “-parameter value1,value2,value3”.
    At line:1 char:116
    + … me $Virtual_machine_name Remove-AzureRmVMNetworkInterface -VM $Virtua …
    + ~~~
    + CategoryInfo : InvalidArgument: (:) [Get-AzureRmVM], ParameterBindingException
    + FullyQualifiedErrorId : ParameterAlreadyBound,Microsoft.Azure.Commands.Compute.GetAzureVMCommand

Leave a Reply

Your email address will not be published. Required fields are marked *