How to Enable Accelerated Networking for Existing Linux VM
Unfortunately, Azure only supports accelerated networking for newly created Linux VM, refer to Create a Linux virtual machine with Accelerated Networking
Accelerated networking can only be enabled for a new NIC. It cannot be enabled for an existing NIC.
Here is the workaround to enable accelerated networking for existing Linux VM.
- You need to login to this VM and run
sudo waagent -deprovision+user
- After that, from Azure CLI command prompt, run
az vm deallocate --resource-group myResourceGroup --name myVM
az vm generalize --resource-group myResourceGroup --name myVM
az image create --resource-group myResourceGroup --name myImage --source myVM
- Now we can use the image to reate a new VM with accelerated networking
az network vnet create --resource-group myResourceGroup --name myVnet --address-prefix 192.168.0.0/16 --subnet-name mySubnet --subnet-prefix 192.168.1.0/24
az network nsg create --resource-group myResourceGroup --name myNetworkSecurityGroup
az network nsg rule create --resource-group myResourceGroup --nsg-name myNetworkSecurityGroup --name Allow-SSH-Internet --access Allow --protocol Tcp --direction Inbound --priority 100 --source-address-prefix Internet --source-port-range "" --destination-address-prefix "" --destination-port-range 22
az network public-ip create --name myPublicIp --resource-group myResourceGroup
az network nic create --resource-group myResourceGroup --name myNic --vnet-name myVnet --subnet mySubnet --accelerated-networking true --public-ip-address myPublicIp --network-security-group myNetworkSecurityGroup
az vm create --resource-group myResourceGroup --name myNewVM --image myImage --size Standard_DS4_v2 --admin-username azureuser --generate-ssh-keys --nics myNic