You all used to right-click a VM and take the snapshot before any activity so that you can revert back to that state in case the activity goes wrong. You may be in shock as this feature is not available in Azure VMs.
Don't get afraid as we are going to tell you a way to create and restore the Azure VM from the snapshot. Azure provides a way to take a snapshot of the disk but not the whole VM so restoring the VM becomes a difficult task.
For creating and reverting the snapshot you need to install the AzureVMSnapshots module by running the command Install-Module AzureVMSnapshots.
Once you have installed the module you can just run the below script which will ask you for the VM whose snapshot you want to take and creates the snapshot of the OS disk.
After taking the snapshot if at any point you want to revert the VM from the snapshot you took in the above step you can simply run the below PowerShell script which will prompt you if you really want to restore the VM. If yes it will power off the VM and replace the original source disk with the snapshot disk.
0 comments:
Post a Comment