How to delete a Network Interface which is attached to a deleted VM?

Daniel Lee 20 Reputation points
2025-10-13T07:39:46.1533333+00:00

Hi everyone,

I'm trying to delete a network interface (NIC) from Azure, but it's complaining that the NIC as attached to a virtual machine that no longer exists in my subscription.

Steps I’ve tried:

  • Deleted the VM (confirmed it’s not showing up anywhere in Azure)
  • Tried deleting the NIC from the Azure Portal, the error says it’s still attached to a non-existent VM
  • Tried using Azure CLI

Has anyone run into this before? How can I force-delete or detach this NIC when the VM no longer exists?

Thanks in advance

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.
0 comments No comments
{count} votes

Answer accepted by question author
  1. Priya ranjan Jena 2,295 Reputation points Microsoft External Staff Moderator
    2025-10-22T15:04:20.4466667+00:00

    Hi Daniel Lee,

    As we discussed over the teams that, we had helped you identify your orphaned NIC was attached to another deployment & you have mentioned M365 Cloud PC had a NIC in azure & you have successfully deleted the NIC now & its fixed.

    We are glad that we are able to help in fixing the issue.

    Please “up-vote” for the information provided & accept this, this can be beneficial to community members.

    Thanks

    0 comments No comments

Answer recommended by moderator
  1. Alan Kinane 17,356 Reputation points MVP Volunteer Moderator
    2025-10-13T08:29:20.75+00:00

    You will probably need to use scripting here. Can you open a CloudShell terminal and try the following AzCli (bash) commands:

    az network nic show --name <NIC_NAME> --resource-group <RESOURCE_GROUP>

    Check if the virtualmachine property is still set here. if so, then remove using the below command:

    az network nic update \

      --name <NIC_NAME> \

      --resource-group <RESOURCE_GROUP> \

      --remove virtualMachine

    1 person found this answer helpful.

3 additional answers

Sort by: Most helpful
  1. Priya ranjan Jena 2,295 Reputation points Microsoft External Staff Moderator
    2025-10-13T12:12:17.9333333+00:00

    Hi Daniel Lee,

    Thanks for the reply, please try to use below comments to delete the NIC.

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

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

    If above steps does not work, please check with resource.azure.com.

    • 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 you find this comment helpful, please “up-vote” for the information provided , this can be beneficial to community members. Kindly let us know if you have any additional questions.

    Thanks

    0 comments No comments

  2. Daniel Lee 20 Reputation points
    2025-10-22T14:39:33.0933333+00:00

    M365 Cloud PC had a NIC in Azure which had to be deprovisioned prior to deleting from withing the Azure Portal.

    0 comments No comments

  3. Daniel Lee 20 Reputation points
    2025-10-22T14:40:02.1333333+00:00

    M365 Cloud PC had a NIC in Azure which had to be deprovisioned prior to deleting from withing the Azure Portal.

    0 comments No comments

Your answer

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