Powershell – Using Powershell Save-AzureVhd to Back up VHD file Receiving 403

azurepowershell

I am executing the following command:

Save-AzureVhd -Source "http://portalvhdsxg6g1pj669bv1.blob.core.windows.net/vhds/{my_vhd_name}.vhd" -LocalFilePath "D:\Virtual Machine Backups\AzureVM.vhd" -NumberOfThreads 5

When I execute the above from powershell, I receive:

Save-AzureVhd : The remote server returned an error: (403) Forbidden.
At line:1 char:1
+ Save-AzureVhd -Source "http://portalvhdsxg6g1pj669bv1.blob.core.windows.net/vhds ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Save-AzureVhd], StorageException
    + FullyQualifiedErrorId : Microsoft.WindowsAzure.Storage.StorageException,Microsoft.WindowsAzure.Commands.ServiceM
   anagement.StorageServices.SaveAzureVhdCommand

I have loaded a publishsettings file downloaded from the Azure site. The settings file imported successfully and my subscription is seen.

Any idea why I'm getting the 403 error? I am currently on a free trial. Could that be the problem? Are there billing related restrictions on download of Azure VHDs even if you have correct subscription credentials?

Best Answer

One thing to try: Specify -StorageKey. I know you imported your publish settings file, but... if you specify the storage key, that key will be used for accessing the storage account, without worrying about what's found via publish settings. This eliminates any potential issue with the publish settings file import, especially if you have more than one subscription and don't have the proper one set as default.

Related Topic