When an Azure VM is deleted does it also removes all the files/directories?

Ananya Sarkar 311 Reputation points
2021-02-16T14:16:47.613+00:00

When an Azure VM is deleted from portal, does it also removes all the files/directories from its file system that were created after it was provisioned?

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
8,110 questions
0 comments No comments
{count} votes

Accepted answer
  1. Andreas Baumgarten 111.6K Reputation points MVP
    2021-02-16T15:09:47.64+00:00

    If you delete a VM in the Azure Portal only the compute object is deleted.
    This means the os disk with file system and all folders and files is still available (and you are charged for it).
    It's easy to verify:

    • Create a VM
    • Delete the VM
    • Click on "All resources" in the Azure Portal and search for the computer name.
    • There should be a disk object with the name <computername>_osdisk_xxxxxxxxxxxxxx

    You have to delete the orphaned disk manually in the Azure Portal.


    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards
    Andreas Baumgarten

    0 comments No comments

4 additional answers

Sort by: Most helpful
  1. SUNOJ KUMAR YELURU 14,626 Reputation points MVP
    2021-02-16T15:10:16.057+00:00

    Hi @Ananya Sarkar
    Thank You for posting Q & A.

    If you remove a Azure VM, the component dependencies, that is data disks, virtual network interfaces, and diagnostic containers, will remain in the resource group. These items won't be automatically deleted along with your OS disc.

    After VM deletion you need to select OS disk & data disk for deletion.

    Once you delete the OS or Data disk it will delete all files and directories.

    refer - Delete a VM overview

    If the Answer is helpful, please click Accept Answer and up-vote, this can be beneficial to other community members.

    0 comments No comments

  2. Ananya Sarkar 311 Reputation points
    2021-02-16T16:35:11.89+00:00

    @SUNOJ KUMAR YELURU . Ok, actually I have deleted the VM, VM-ip, NSG, disk & NIC from the resource group. This means that the files will also get removed, whatever i have added earlier. Is it correct?
    I want to ensure that the files that i added cannot be retrieved, once I remove the VM from azure portal. Plz confirm.

    0 comments No comments

  3. Andreas Baumgarten 111.6K Reputation points MVP
    2021-02-16T17:38:34.197+00:00

    This means that the files will also get removed, whatever i have added earlier. Is it correct?

    All files, folders on the disk and the disk itself are gone if you delete the disk object resource in Azure.

    In Azure it's the same like with on-premises virtualisation (Hyper-V or VMware): If you delete a disk object (vhdx file or vmdk file) all data, files, folders in the vhdx/vmdk file are "gone" as well.


    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards
    Andreas Baumgarten


  4. Garrana 1 Reputation point Microsoft Employee
    2022-11-23T06:35:36.3+00:00

    you have the option now to delete the Disks , IPs and Nics associated to the Virtual machine when you delete the VM. you have to choose the setting while you are creating the VM
    https://learn.microsoft.com/en-us/azure/virtual-machines/delete?tabs=portal2%2Ccli3%2Cportal4%2Cportal5

    0 comments No comments

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.