I am trying to add a VHD image from my local filesystem to Azure BLOB storage. Whenever I do this after about 6 minutes I get the error "The remote server returned an error: (400) Bad Request". I use the following steps to upload the image (using Azure Resource Manager):

PS C:\Users\myuser> Set-AzureRmContext -SubscriptionId aaaaaaaa-bbbb-cccc-dddd-0123456789012

Environment           : AzureCloud
Account               : mysuer@outlook.com
TenantId              : aaaaaaaa-bbbb-cccc-dddd-0123456789012
SubscriptionId        : aaaaaaaa-bbbb-cccc-dddd-0123456789012
SubscriptionName      : MySubscription
CurrentStorageAccount :

PS C:\Users\myuser>
PS C:\Users\myuser> $rgName = "MyResourceGroupName"
PS C:\Users\myuser> $urlOfUploadedImageVhd = "https://myblobaccount.blob.core.windows.net/myvirtualmachine.vhd"
PS C:\Users\myuser>
PS C:\Users\myuser> Add-AzureRmVhd -ResourceGroupName $rgName -Destination $urlOfUploadedImageVhd -LocalFilePath C:\Users\myuser\myvirtualmachine.vhd
MD5 hash is being calculated for the file  C:\Users\myuser\myvirtualmachine.vhd.
MD5 hash calculation is completed.
Elapsed time for the operation: 00:06:29
Creating new page blob of size 136365212160...
Add-AzureRmVhd : The remote server returned an error: (400) Bad Request.
At line:1 char:1
+ Add-AzureRmVhd -ResourceGroupName $rgName -Destination $urlOfUploaded ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Add-AzureRmVhd], StorageException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.Compute.StorageServices.AddAzureVhdCommand

I have no idea how to debug this further? I would very much appreciate any help in finding out what is going wrong.


Your Azure Storage Account type is "Blob Storage". According to docs, it doesn't do page blobs, which are required for VMs.

Fix this by uploading into a General Purpose storage account. More info in my blog.

  • Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. – Jenny D Jul 6 '17 at 7:06
  • Ok, that may be why - but wouldn't it make sense for the Add-AzureRmVhd to check the type of storage and simple issue a warning message? The 400 is not very helpful. – Yooakim Jul 14 '17 at 8:06
  • Jenny: All the relevant information is there: 1) Storage Account is of wrong type 2) How to fix this What else would you like to see there? – Jari Turkia Jul 14 '17 at 16:37
  • Yooakim: I agree on your point there. As I don't work for Microsoft, I have no idea why they don't make their error message more informative. – Jari Turkia Jul 14 '17 at 16:39

Add -Debug switch to see the actual REST calls.


It might help to try manually uploading a page blob on the azure portal website to find the cause of the issue. For a VHD you need a page blob. Note that these are not supported on zone redundant storage accounts. More details can be found here.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.