How to disable the Azure VM accelerated settings using PowerShell?

PowerShellMicrosoft TechnologiesSoftware & Coding

<p>To disable the Azure VM accelerated settings using PowerShell, we need to disable the <strong>EnableAcceleratedNetworking</strong> property on the NIC attached to the VM.</p><pre class="prettyprint notranslate">$vm = Get-AzVM -Name TestVM $nicname = (($;/&#39;))[-1] $nicsetting = Get-AzNetworkInterface -ResourceGroupName $vm.ResourceGroupName - Name $nicname $nicsetting.EnableAcceleratedNetworking = $false</pre><p>In the above example, we are setting AN settings on the Azure VM <strong>&ldquo;TestVM&rdquo;.&nbsp;</strong>To set the AN setting on the particular subscription, use the below command. Make sure that you are connected to the proper subscription using the <strong>Set-AzContext</strong> command.</p><pre class="prettyprint notranslate">Get-AzVM | Select Name, ResourceGroupName,` &nbsp; &nbsp;@{N=&#39;Accelerated Netoworking&#39;; E={ &nbsp; &nbsp; &nbsp; $nic = (($;/&#39;))[-1] &nbsp; &nbsp; &nbsp; $nicsetting = Get-AzNetworkInterface - &nbsp; &nbsp; &nbsp; ResourceGroupName $_.ResourceGroupName -Name $nic &nbsp; &nbsp; &nbsp; $nicsetting.EnableAcceleratedNetworking = $true &nbsp; &nbsp; &nbsp; if($nicsetting.EnableAcceleratedNetworking){&quot;Enabled&quot;} &nbsp; &nbsp; &nbsp; else{&quot;Disabled&quot;} &nbsp; &nbsp;}}</pre><p>To set the AN settings on the VMs of the particular resource group, use <strong>Get-AzVM - ResourceGroupName &lsquo;ResourceGroup&rsquo;</strong> instead of Get-AzVM in the above code.</p>
Updated on 31-Aug-2021 11:00:48