IaaS


Help! Someone disabled my virtual network adapter @ my Azure VM

Today someone asked my how to re-enable an Azure VM network adapter. Using an on-premise hypervisor like VMware you can use the console session to access and re-enable the virtual network adapter. In this blogpost I describe how to deal with this situation when it’s inside an Azure VM. Help is on the way!

You can use the Azure Portal or use Powershell to regain access to your virtual machine.

Resolve using the Azure Portal

Log on to the Azure portal and go to the virtual network adapter settings on the Virtual Machine pane :

Azure VM IP Address

Change the IP address to any other valid IP address in the same subnet. After changing Azure automatically re-enables the virtual network adapter. Better safe than sorry, reboot the virtual machine and change the IP address to the old value (when it needs to be static) and now you have access to the virtual machine again!

Resolve using Azure Powershell

Use these steps to use the command line. Go to shell.azure.com or open an Azure powershell environment.

Azure Cloud Shell

Find the NIC details of the VM that we need to fix using the following command :

Get-AzureRmNetworkInterface -ResourceGroupName “My-ResourceGroup”

Notice the network interface name, IP address and allocation method you are using.

Azure VM IP Address PS

Now we need to assign a different IP address to the same nic from the same subnet.

Use the following Powershell commands :

$Nic = Get-AzureRmNetworkInterface -ResourceGroupName "My-ResourceGroup" -Name "my_AzureVM"
$Nic.IpConfigurations[0].PrivateIpAddress = "10.2.5.197"
$Nic.IpConfigurations[0].PrivateIpAllocationMethod = "Static"
$Nic.Tag = @{Name = "Name"; Value = "Value"}
Set-AzureRmNetworkInterface -NetworkInterface $Nic

Reboot your virtual machine and change IP address back to the old value. You are all set!


How to quickly encrypt/decrypt Azure VM disks using the portal

Some time ago Microsoft added the encryption option on the disk pane (Azure IaaS properties). Now you don’t need to use the CLI or Powershell commando’s to decrypt/encrypt your VM disks.

Encryption15102019-001

Just go to the encryption button and the options already speak for themselves. When you already have one disk encrypted and just added an extra disk you can easily use the (keyvault) settings  that are already in place. You can also choose to add an additional keyvault/Key/Version.

Encryption15102019-002

Using this command it’s also very easy to disable disk encryption. Just go to Disks to encrypt and choose None. The encryption will be removed.

Encryption15102019-003

Make sure that your VM must be up and running (and when you encrypt your OS disk your VM might reboot)