igerx.blogg.se

Azure disk snapshot
Azure disk snapshot




Each command in the table links to command specific documentation. This script uses following commands to create a managed disk from a snapshot. New-AzDisk -Disk $diskConfig -ResourceGroupName $resourceGroupName -DiskName $diskName $diskConfig = New-AzDiskConfig -SkuName $storageType -Location $location -CreateOption Copy -SourceResourceId $snapshot.Id -DiskSizeGB $diskSize $snapshot = Get-AzSnapshot -ResourceGroupName $resourceGroupName -SnapshotName $snapshotName Select-AzSubscription -SubscriptionId $SubscriptionId #Set the context to the subscription Id where Managed Disk will be created

azure disk snapshot

#Get all the Azure location using command below: #This location should be same as the snapshot location westus) where Managed Disks will be located. #Provide the storage type for Managed Disk. It should be greater than the VHD file size. #Provide the name of the snapshot that will be used to create Managed Disks $resourceGroupName ='yourResourceGroupName' Sample script #Provide the subscription Id If you don't have an Azure subscription, create an Azure free account before you begin. You can also restore data disks of an existing VM by attaching data disks created from snapshots. Create OS and data managed disks from respective snapshots and then create a new virtual machine by attaching managed disks. Use it to restore a virtual machine from snapshots of OS and data disks. The scripts are available in my GitHub repo here: Creating a snapshot #Ĭreate-DiskSnapshot.ps1 creates an Azure Disk Snapshot in the same location as the source disk.This script creates a managed disk from a snapshot. Going through this process a few times led me to creating some PowerShell scripts to automate this process (and create this blog post!).Īfter understanding the steps needed and the PowerShell cmdlets for each, the next step was of course to write scripts to automate all the individual steps.

azure disk snapshot

This allowed me to practice my demo over and over and over again, make adjustments, and then practice some more. Two: I could take a snapshot of the VM, run through my demo, and then revert the VM to it’s pre-demo state. Using a fresh machine ensured I had to account for everything. I didn’t want to demo from my machine and forget about some random configuration or setting. One: I was preparing the demo from a base Windows 10 machine (or pretty close to it), so I was pretty confident that my material would work for anyone else. I used a virtual machine in Azure to perform the demo which gave me two great benefits. This gave me the chance to practice, and rehearse, and fine tune my content. I recently prepared a Lightning Demo for the 2021 PowerShell + DevOps Global Summit, which thankfully was a pre-recorded session and not live.






Azure disk snapshot