Cannot delete orphaned azure network interface

Charles Latham 20 Reputation points
2025-04-19T21:35:15.5533333+00:00

I'm unable to delete two network interfaces that are attached to virtual machines that no longer exist:

Remove-AzNetworkInterface -Name [my nic] -ResourceGroupName [my rg] -Force

Remove-AzNetworkInterface : Network Interface /subscriptions/[path to nic] is used by existing resource /subscriptions/[path to vm]. In order to delete the network interface, it must be dissociated from the resource.

I've tried using Azure CLI to remove the virtual machine from the nic but it only displays the json configuration without removing the vm.

az network nic update --name [my nic] --resource-group [my rg] --remove virtualMachine

I've tried opening a support ticket to have network interfaces removed on the backend but I don't have that level of support.

Azure Virtual Network
Azure Virtual Network
An Azure networking service that is used to provision private networks and optionally to connect to on-premises datacenters.
2,720 questions
{count} votes

Accepted answer
  1. G Sree Vidya 905 Reputation points Microsoft External Staff
    2025-04-21T01:21:35.47+00:00

    Hello Charles Latham

    I wanted to follow up and check if you had the opportunity to review the information provided by Suwarna in our previous post.

    Additionally, you can use below comments to to delete the nics,

    Get-AzNetworkInterface | where-object { $_.VirtualMachine -eq $null } | ft name

    Get-AzNetworkInterface | where-object { $_.VirtualMachine -eq $null } | Remove-AzNetworkInterface -Force

    As above steps do not work, we have suggested check with resource.azure.com after checking NIC.

    • Open a web browser and navigate to https://resources.azure.com
    • Log-in to the appropriate Azure account
    • In the blade on the left side of the browser, expand subscriptions, then expand the desired subscription name
    • In the blade on the left side of the browser, expand resource groups
    • Under resource groups, expand the proper Resource Group Name
    • Under the Resource Group, expand providers
    • Under providers, expand Microsoft.Network
    • Under Microsoft.Network, expand networkinterfaces
    • Under networkinterfaces, select the NIC which you are failing to delete.
    • Near the top of the content window of the browser, select the Read/Write push button
    • Select the Actions(POST, DELETE) tab and click on Delete.

    If an answer has been helpful, please consider accepting the answer to help increase visibility of this question for other members of the Microsoft Q&A community. If not, please let us know what is still needed in the comments so the question can be answered. Thank you for helping to improve Microsoft Q&A! User's image

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.