Copying your VM Disk to Storage account
To copy the VM disk to your storage account follow the below steps
Step 1: Create a New Storage account and a container inside in it
Step 2: Then open the Azure CLI
Step 3: Then execute the below script in AzureCLI
#Provide all the details as shown below $subscriptionId = "3902ccd9-9777-4de2-a0a6-eefa61b34ca5" $resourceGroupName ="yourResourceGroupName" $managedDiskName = "yourManagedDiskName" $sasExpiryDuration = "3600" $storageAccountName = "yourstorageaccountName" $storageContainerName = "yourstoragecontainername" $storageAccountKey = "yourStorageAccountKey" $destinationVHDFileName = "yourvhdfilename" #Logs in to the Azure Account & Select AzureRM subscription Login-AzureRmAccount Select-AzureRmSubscription -SubscriptionId $SubscriptionId #Generate the SAS for the managed disk $sas = Grant-AzureRmDiskAccess -ResourceGroupName $resourceGroupName -DiskName $managedDiskName -Access Read -DurationInSecond $sasExpiryDuration $destinationContext = New-AzureStorageContext –StorageAccountName $storageAccountName -StorageAccountKey $storageAccountKey #Copy the snapshot to the storage account and wait for it to complete Start-AzureStorageBlobCopy -AbsoluteUri $sas.AccessSAS -DestContainer $storageContainerName -DestContext $destinationContext -DestBlob $destinationVHDFileName while(($state = Get-AzureStorageBlobCopyState -Context $destinationContext -Blob $destinationVHDFileName -Container $storageContainerName).Status -ne "Success") { $state; Start-Sleep -Seconds 5 } $state
This will copy the VM disk to VHD file (Virtual Hard Disk )
And the below command will upload the status as shown

11 Responses
… [Trackback]
[…] Read More on that Topic: azuredevopsguide.com/copying-your-vm-disk-to-storage-account/ […]
… [Trackback]
[…] Here you can find 51143 more Info on that Topic: azuredevopsguide.com/copying-your-vm-disk-to-storage-account/ […]
… [Trackback]
[…] Read More on that Topic: azuredevopsguide.com/copying-your-vm-disk-to-storage-account/ […]
… [Trackback]
[…] Read More to that Topic: azuredevopsguide.com/copying-your-vm-disk-to-storage-account/ […]
… [Trackback]
[…] Here you can find 85608 additional Info on that Topic: azuredevopsguide.com/copying-your-vm-disk-to-storage-account/ […]
… [Trackback]
[…] Read More on that Topic: azuredevopsguide.com/copying-your-vm-disk-to-storage-account/ […]
… [Trackback]
[…] Find More on to that Topic: azuredevopsguide.com/copying-your-vm-disk-to-storage-account/ […]
… [Trackback]
[…] Read More Info here to that Topic: azuredevopsguide.com/copying-your-vm-disk-to-storage-account/ […]
… [Trackback]
[…] Find More here to that Topic: azuredevopsguide.com/copying-your-vm-disk-to-storage-account/ […]
… [Trackback]
[…] Info to that Topic: azuredevopsguide.com/copying-your-vm-disk-to-storage-account/ […]
… [Trackback]
[…] Find More on on that Topic: azuredevopsguide.com/copying-your-vm-disk-to-storage-account/ […]