

New-AzureRmDisk -Disk $DiskConfig -ResourceGroupName $ResourceGroupName -DiskName $NewDiskName $DiskConfig = New-AzureRmDiskConfig -AccountType $StorageType -Location $location -CreateOption Copy -SourceResourceId $Snapshot.Id $Snapshot = Get-AzureRmSnapshot -ResourceGroupName $ResourceGroupName -SnapshotName $SnapshotName New-AzureRmSnapshot -Snapshot $Snapshot -SnapshotName $SnapshotName -ResourceGroupName $ResourceGroupNameĬreate Managed Disk from Snapshot $StorageType = "PremiumLRS" # if you need hdd use StandardLRS $Snapshot = New-AzureRmSnapshotConfig -SourceUri $Disk.Id -CreateOption Copy -Location $location $Disk = Get-AzureRmDisk -ResourceGroupName $resourceGroupName -Name "osdisk" Stop-AzureRmVM -ResourceGroupName $resourceGroupName -Name "VMtoRestore"

Shutdown Virutal Machine $resourceGroupName = "TestGroup"

Why not just replace OS disk? Let's start from the beginning. At the moment official way to restore Virtual Machine from a snapshot is to recreate VM.
