Microsoft Azure has the option to enable Accelerated Networking on VM’s. More information on the feature can be found here but this post is not to tell you about what good it does nor how it works.. no, this post is to introduce a new script that will enable/disable the function for you!
The script works similar to the AvailabilitySet script made by Paulo Marques which uses the possibility of exporting the ARM template of the resource group and then prepare that template for redeployment with the correct values (in our case the enableAcceleratedNetworking=’True’ value)
During the enable/disabling of the feature, the VM itself and ALL related NIC’s are deleted and re-created. It is advised to have a backup of your VM available. We do not hold any responsibility for lost data/VM’s.
Beware that if you use a dynamic Public IP address for the VM, the public IP address will change as the VM is redeployed
Note that the VM size must support the Accelerated Networking feature.. the script validates on this based on the “common” sizes used. If you use a special VM size (H/N series) you might need to alter the script a little bit..
- Download / Unzip/ Import the modules. Open PowerShell and login to Azure using Add-AzureRMAccount.
- Import-Module .\AzureRm.AcceleratedNIC.CoreHelper.psm1
- Import-Module .\AzureRm.AcceleratedNIC.Management.psd1
- Get the OS information from the VM (it will be required)
- Run the following command to ADD Accelerated Networking to a VM:
- Add-AzureRmAcceleratedNIC -ResourceGroupName ‘NICTEST’ -VMName ‘NICVM’ -OsType linux
- Run the following command to REMOVE Accelerated Networking from a VM:
- Remove-AzureRmAcceleratedNIC -ResourceGroupName ‘NICTEST’ -VMName ‘NICVM’ -OsType linux