Reverting back to snapshot

sns 9,231 Reputation points
2023-12-05T13:34:30.88+00:00

I have snapshot of OS disk, I want to revert to back to snapshot state of that VM, Please suggest how it can be done

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,549 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Luis Arias 5,981 Reputation points
    2023-12-05T14:06:56.0266667+00:00

    Hello sns, Reverting an Azure VM to a snapshot state in Azure is a bit different than in other environments.Even so Azure allows create disk snapshots, As I know for now it doesn't provide a direct option to revert the same VM back to the previously created snapshot.

    Here there is another conversation thread about it: https://learn.microsoft.com/en-us/answers/questions/488329/how-can-i-revert-my-azure-vm-to-a-previously-saved

    Alternative option is creating a new disk from the snapshot and then swapping the OS disk of your VM with this new disk. Here are the steps:

    1. Create a new disk from the snapshot either by portal ( In the snapshot blade, click on + Create disk. ) or Azure PowerShell example:
    $SnapshotName = "my_snapshot"
    $SnapshotResourceGroup = "my_resource_group"
    $DiskNameOS = "my_new_snapshotdisk"
    
    $snapshotinfo = Get-AzSnapshot -ResourceGroupName $SnapshotResourceGroup -SnapshotName $snapshotName
    
    New-AzDisk -DiskName $DiskNameOS (New-AzDiskConfig -zone 1 -Location eastus -CreateOption Copy -SourceResourceId $snapshotinfo.Id) -ResourceGroupName $SnapshotResourceGroup
    
    
    1. From the Azure portal going to the VM, selecting "disks", and then selecting "swap os disk" ( it will cause a reboot )

    Let me know if you need additional help.

    Luis


    If the information helped address your question, please Accept the answer.

    1 person found this answer helpful.
    0 comments No comments

  2. TP 83,711 Reputation points
    2023-12-05T14:01:21.5133333+00:00

    Hi,

    Navigate to snapshot in portal, click Create disk, complete necessary info and create. Wait for it to finish creating new Disk. Next navigate to the VM -- Disks blade, click Swap OS disk, select disk you created above, type in name of VM to confirm, click OK. Once the swap has finished you can navigate back to Overview blade and click Start.

    The above is for VM that only has OS disk.

    Please click Accept Answer and upvote if above was helpful.

    Thanks.

    -TP

    0 comments No comments