我尝试将vhd上传到azure(固定大小为30GB),但在上传结束后总是给我一个错误。
在此之前,我已导入我的发布设置文件,我将其设置为默认的subscritption,并将默认存储设置为vhds
Add-AzureVhd -Destination "https://*****.blob.core.windows.net/vhds/vm.vhd" -LocalFilePath "C:\Users\****\Desktop\vm.vhd"
MD5 hash is being calculated for the file C:\Users\****\Desktop\vm.vhd.
MD5 hash calculation is completed.
Elapsed time for the operation: 00:02:59
Creating new page blob of size 32212255232...
Add-AzureVhd : The remote server returned an error: (400) Bad Request.
At line:1 char:1
+ Add-AzureVhd -Destination "https://*****.blob.core.windows.net/vhds ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Add-AzureVhd], StorageException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Storage.StorageException,Microsoft.WindowsAzure.Commands.ServiceM
anagement.StorageServices.AddAzureVhdCommand
您对如何排除故障有任何想法吗?
答案 0 :(得分:2)
以下是一些排除故障的建议。我刚刚尝试了同样的挑战。
首先,我认为您的错误会在上传之前弹出。因为整个过程看起来像这样。并且看起来在尝试创建新blob后立即弹出错误。之后是一个漫长的过程,其中检测到VHD的空白区域。
PS C:\Users\pkirch> Add-AzureVhd -LocalFilePath 'C:\Hyper-V\Virtual Hard Disks\test30gb.vhd' -Destination "https://webdavsvr.blob.core.windows.net/vhds/test30gb.vhd"
MD5 hash is being calculated for the file C:\Hyper-V\Virtual Hard Disks\test30gb.vhd.
MD5 hash calculation is completed.
Elapsed time for the operation: 00:02:58
Creating new page blob of size 32212255232...
Detecting the empty data blocks in the local file.
Detecting the empty data blocks completed.
Elapsed time for upload: 00:00:00
LocalFilePath DestinationUri
------------- --------------
C:\Hyper-V\Virtual Hard Disks\test30gb.vhd https://webdavsvr.blob.core.windows.net/vhds/test30gb.vhd
前段时间我发布了script to upload a VHD on GitHub Gist。如果您不错过任何一步,请查看。主要是:
# Settings $SubscriptionName = "Azure MSDN - pkirchner" $StorageAccountName = "pkteststorageaccount" $Container = "vhds" $LocalVhd = "C:\Users\pkirch\fixedvhd20mb.vhd" # Select my Microsoft Azure Subscription. Select-AzureSubscription -SubscriptionName $SubscriptionName # Create new storage account. New-AzureStorageAccount -Location "West Europe" -StorageAccountName $StorageAccountName -Type Standard_LRS # Create container for VHDs. $StorageAccountKey = Get-AzureStorageKey -StorageAccountName $StorageAccountName New-AzureStorageContext -StorageAccountKey $StorageAccountKey.Primary -StorageAccountName $StorageAccountName | ` New-AzureStorageContainer -Name $Container -Permission Off # Add-AzureVhd needs the CurrentStorageAccountName to be set. Set-AzureSubscription -SubscriptionName $SubscriptionName -CurrentStorageAccountName $StorageAccountName # Build destination path automatically. $NewContainer = Get-AzureStorageContainer -Name $Container $VhdFile = Split-Path -Path $LocalVhd -Leaf $Destination = $NewContainer.CloudBlobContainer.Uri.AbsoluteUri + "/" + $VhdFile # Upload VHD Add-AzureVhd -Destination $Destination -LocalFilePath $LocalVhd
第二次,如果您没有遗漏任何步骤,我会尝试使用Fiddler查找错误。使用Fiddler和PowerShell for Azure并不简单。这是blog post如何做到的。