How to get the Accelerated networking status of Azure VM using PowerShell?


From the Azure Portal, we can find the Accelerated Networking (AN) status from the networking blade.


To get the AN settings on the VM, we need to first retrieve the NIC information because it is set on it. We have the VM named ‘TestVM’ and we will retrieve its NIC information.

PS C:\> $vm = Get-AzVM -Name TestVM

To get the NIC associated with the VM,

$nicname = (($vm.NetworkProfile.NetworkInterfaces.id).Split('/'))[-1]

We need to retrieve the NIC settings to get the AN setting.

$nicsetting = Get-AzNetworkInterface -ResourceGroupName $vm.ResourceGroupName -
Name $nicname

To get the AN settings, use the EnableAcceleratedNetworking property.

$nicsetting.EnableAcceleratedNetworking

If you want to retrieve the AN settings on all the Azure VMs from the particular subscription then use the below command but make sure that you are connected to the particular subscription using the SetAzContext command.

Get-AzVM | Select Name, ResourceGroupName,`
   @{N='Accelerated Netoworking'; E={
      $nic = (($_.NetworkProfile.NetworkInterfaces.id).Split('/'))[-1]
      $nicsetting = Get-AzNetworkInterface - ResourceGroupName $_.ResourceGroupName -Name $nic
      $nicsetting.EnableAcceleratedNetworking
   }}

To set the AN settings on the VMs of the particular resource group, use Get-AzVM - ResourceGroupName ‘ResourceGroup’ instead of Get-AzVM in the above code.

Updated on: 31-Aug-2021

435 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements