Skip to content

Instantly share code, notes, and snippets.

@darrenjrobinson
Last active April 4, 2017 00:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save darrenjrobinson/0b01dc3e7034cf2fcbd90ca00fbb4dc2 to your computer and use it in GitHub Desktop.
Save darrenjrobinson/0b01dc3e7034cf2fcbd90ca00fbb4dc2 to your computer and use it in GitHub Desktop.
Upload VHD to Azure Blob Storage
# Variables
$storageaccount = 'mystorageaccount'
$vhdpath = 'c:\users\darrenjrobinson\vhds\WindowsVM.vhd'
$BlobName = 'WinXP.vhd'
# Login
Login-AzureRMAccount
Get-AzureRmStorageAccount | select storageaccountname
# Get Storage Account
$storageContainer = Get-AzureRmStorageAccount | where {$_.StorageAccountName -eq $storageaccount} | Get-AzureStorageContainer
# Upload VHD
$storageContainer | Set-AzureStorageBlobContent –File $vhdpath –Blob $BlobName -BlobType Page
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment